Hi I have the working tool for the UPS access and updates. Because I didnt have SharePoint administrator role, I was unable to perform actual property updates. After I received SP administrator role(with MFA - this is our company policy elivated permission should have a MFA configured), The following authCookie (last line) fails staing Miss match with the stored Microsoft account details in the system.. This is because we have MFA configured. code has to be entered. I then did PnP.Framework setup however I am not able to replace the following with the PnP MFA authentication code replacement. Will you advise?
static bool InitializeWebService()
{
try
{
string webServiceExt = "_vti_bin/userprofileservice.asmx";
string adminWebServiceUrl = string.Empty;
//append the web service (ASMX) url onto the admin web site URL
if (_profileSiteUrl.EndsWith("/"))
adminWebServiceUrl = _profileSiteUrl + webServiceExt;
else
adminWebServiceUrl = _profileSiteUrl + "/" + webServiceExt;
LogMessage("Initializing SPO web service " + adminWebServiceUrl, LogLevel.Information);
SecureString securePassword = GetSecurePassword(_sPoAuthPasword);
SharePointOnlineCredentials onlineCred = new SharePointOnlineCredentials(_sPoAuthUserName, securePassword);
// Get the authentication cookie by passing the url of the admin web site
string authCookie = **onlineCred.GetAuthenticationCookie(new Uri(_profileSiteUrl));**
// Setting up the user profile web service
_userProfileService = new UPSvc.UserProfileService();
// assign the correct url to the admin profile web service
_userProfileService.Url = adminWebServiceUrl;
// Assign previously created auth container to admin profile web service
_userProfileService.CookieContainer = authContainer;
// LogMessage("Finished creating service object for SPO Web Service " + adminWebServiceUrl, LogLevel.Information);
return true;
Please let me know. Appreciate any help.