Baskar G

Baskar G

  • NA
  • 8
  • 565

Folder haven't been shared in Onedrive

Mar 28 2019 2:18 PM
I am sharing my onedrive folder programmatically to some users using Microsoft.SharePoint.Client. Its showing file are shared with users successfully and have label like its shared with users from sender end. But In receivers end is doesnt not received at all.
 
I tried below Microsoft.SharePoint.Client code to share the folder
 
ClientContext ctx = new ClientContext("My onedrive URL");
ctx.Credentials = new SharePointOnlineCredentials(username, passWord);
Principal user = ctx.Web.EnsureUser("");
var roleDefinition = ctx.Site.RootWeb.RoleDefinitions.GetByType(RoleType.Reader); //get Reader role
var roleBindings = new RoleDefinitionBindingCollection(ctx) { roleDefinition };
folder.ListItemAllFields.RoleAssignments.Add(user, roleBindings);
ctx.Load(folder);
ctx.ExecuteQuery();
 
Let me know what is the issue its having? Or its a issue from One drive Site?

Answers (1)