EnsureUser using email address in SharePoint client object model -


i need update fielduservalue field in sharepoint 2013. given email address data. can't user ensureuser since accepts logonname. used fromuser method gives me error says "the user not exist or not unique"

fielduservalue user = fielduservalue.fromuser(email); 

it worked when tried using email address when use email addresses in data results in error. how fix issue?

you resolve user email address using utility.resolveprincipal method, example:

var result = microsoft.sharepoint.client.utilities.utility.resolveprincipal(ctx, ctx.web, emailaddress,microsoft.sharepoint.client.utilities.principaltype.user,microsoft.sharepoint.client.utilities.principalsource.all, null, true); ctx.executequery(); if (result != null) {     var user = ctx.web.ensureuser(result.value.loginname);     ctx.load(user);     ctx.executequery();     }  

references

get user identity , properties in sharepoint 2013


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -