CSOM을 통해 요청 액세스 이메일 주소 설정
-
10-12-2019 - |
문제
서버측 객체 모델에서는 속성을 통해 요청 액세스 이메일 주소를 설정할 수 있습니다. SPWeb.RequestAccessEmail
(MSDN).
SharePoint 테넌트를 Office365로 이동할 예정이므로 이 값을 설정하는 방법을 찾고 있습니다.UI(사이트 설정 > 사이트 권한 > 액세스 요청 설정)에서 수동으로 수행할 수 있다는 것을 알고 있지만 일부 셀프 서비스 사이트 생성 기능이 있으므로 웹이 생성될 때마다 이를 수동으로 변경할 수는 없습니다.
아쉽게도 재산은 없습니다 Web.RequestAccessEmail
클라이언트 측 객체 모델에서.
속성 모음(일명)을 통해 이 이메일 주소를 설정하는 방법이 있습니까? Web.AllProperties["__SecretKey"]
), 웹 서비스(_vti_bin
, 등) 또는 다른 해결 방법이 있나요?
어떤 도움이라도 대단히 감사하겠습니다!
해결책
"SharePoint Online Management Shell"(v16.0.4630.1200)의 최신 릴리스에는 다음이 포함되어 있습니다. Microsoft.SharePoint.Client.dll
속성을 추가합니다 RequestAccessEmail
~로 Web
수업.
다운로드: https://www.microsoft.com/en-us/download/details.aspx?id=35588
NuGet-Package가 출시될 때까지 이 DLL을 사용할 수 있습니다.
편집하다:버전 이후 16.1.4727.1200
~의 Microsoft.SharePointOnline.CSOM
NuGet 패키지 RequestAccessEmail
속성이 지원됩니다.
다른 팁
안타깝게도 이 숙소는 다음을 통해 접근할 수 없습니다. CSOM
.
웹 클라이언트 개체에 대해 사용 가능한 모든 속성을 검색하는 방법:
var allProperties = clientContext.Web.AllProperties;
clientContext.Load(allProperties);
clientContext.ExecuteQuery();
이것은 가능하지만 제 생각에는 해킹입니다.나는 이것이 유효한 방법인지 논의하기 위해 기사를 썼습니다. IFrame을 통해 SharePoint UI를 조작하여 누락된 클라이언트측 기능 추가
코드는 다음과 같습니다.
//quite dirty hack but at this point the only possibility to set the AccessRequest mail via clientside
function setAccessRequest(mail) {
var iframe = document.createElement('iframe');
//set the setrqacc.aspx link
var setrqaccUrl = _spPageContextInfo.webAbsoluteUrl + '/_layouts/15/setrqacc.aspx?type=web';
//create setrqacc.aspx hidden iframe
iframe.setAttribute('src', setrqaccUrl);
iframe.setAttribute('style', 'display:none');
iframe.onload = function () {
//this will fire 2 times - the first time when its initially loaded. the second after the changes were applied (page is reloaded (postback) after the submitbutton is triggered)
var $iframeInput = $('input[id*="_txtEmail"]', $(iframe).contents());
if ($iframeInput.length) {
//initial load - apply settings
$iframeInput.val(mail);
//gets iframeInput's parent so the current input can be placed inside
var $iframeBtn = $('input[id*="_btnSubmit"]', $(iframe).contents());
//trigger the post
$iframeBtn.trigger('click');
} else {
//second load - do callback
callback('AccessRequest');
}
};
document.body.appendChild(iframe);
}
사용자가 페이지를 종료하려고 하면 대기 대화 상자와 일부 경고로 래핑되어야 합니다.IFrame에서 페이지를 로드하는 데 시간이 좀 걸릴 수 있으며 이 코드는 이를 두 번 수행합니다.