쿼리 문자열 값 "optout = Yes"를 읽는 숨겨진 웹 파트가 있습니다. 이 optout = 예, 프로필 속성을 업데이트해야합니다. 내 코드에서 보면. "userprof.Commit()"실패 및 ""실패 GET 요청에 대한 업데이트가 허용되지 않습니다 .GET에서 업데이트를 허용하려면 SPWeb의 AllowUnsafeUpdates 속성을 "으로 설정하십시오. 이것에 대한 해결책은 무엇입니까?현재 GET 요청에 대한 업데이트가 허용되지 않습니다. GET에서 업데이트를 허용하려면 SPWeb에서 'AllowUnsafeUpdates'속성을 설정하십시오.
private void OptOutMemberInvitation()
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
//update the invitee's Profile property
UpdateInviteeOptOutProfile(InviteeConstitID);
});
}
private void UpdateInviteeOptOutProfile(string inviteeSiteColUrl)
{
ServerContext sc = ServerContext.Current;
UserProfileManager upm = new UserProfileManager(sc);
//Get the user profile
Microsoft.Office.Server.UserProfiles.UserProfile userprof = upm.GetUserProfile(MemberConstitID);
SPWeb web = userprof.PersonalSite.RootWeb;
//make sure we can update our list
web.AllowUnsafeUpdates = true;
web.Update();
//Update the OptOut Property on the user's profile.
userprof["OptOut"].Value = "Yes";
userprof.Commit(); //Fails here
//update the list item to persist it to list
web.AllowUnsafeUpdates = false;
//siteCol.Close();
//siteCol.Dispose();
}
이 게시물은 나를 도와줍니다. 고맙습니다. – trgraglia
대답을 찾았습니까? –