Guest User

Untitled

a guest
Jul 16th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. using Microsoft.SharePoint.Client;
  2. using Microsoft.SharePoint.Client.DocumentManagement;
  3.  
  4. // Replace all instances of < > with your variables
  5. using (var context = new ClientContext(<siteUrl>))
  6. {
  7. context.Credentials = new SharePointOnlineCredentials(UserName, SecurePass);
  8. listToOperate = context.Web.GetListByUrl(<listRelUrl>);
  9. context.Load(listToOperate);
  10. context.ExecuteQuery();
  11.  
  12. //Create the folder first
  13. Folder folder = listToOperate.RootFolder.EnsureFolder(folderName);
  14. context.ExecuteQueryRetry(5);
  15.  
  16. //Setting the Metadata Defaults for the Folder
  17. metadataDefaults.SetFieldDefault(folder, "<ColumnName>", "-1;#" + <taxonomy values>);
  18. metadataDefaults.Update();
  19. listToOperate.Update();
  20. context.ExecuteQuery();
  21. }
Add Comment
Please, Sign In to add comment