1

I have a small project that requires migrating from Sharepoint 2010 to Sharepoint Online. According to Microsoft, tags have been discontinued.

I have been able to add Enterprise Keywords and custom metadata columns which works great.

Sharepoint Online still has a column for tags (despite it not being editable). The client is still very much focused on tags for the moment. I cannot seem to figure out how to assign a tag via C#. Is there anyone who could point me in the right direction?

using (var cc = new OfficeDevPnP
    .Core
    .AuthenticationManager()
    .GetSharePointOnlineAuthenticatedContextTenant(
        "https://company.sharepoint.com/sites/", 
        "Test@test.com", 
        "password")) 
    {
        Web web = cc.Web;

        FileCreationInformation newFile = new FileCreationInformation();
        newFile.Content = System.IO.File.ReadAllBytes(@"C:\Test\Upload.jpg");
        newFile.Url = "Upload.jpg";

        Microsoft.SharePoint.Client.List docs 
            = web.Lists.GetByTitle("Documents");

        Folder folder = docs.RootFolder.Folders.GetByUrl("General");
        File uploadFile = folder.Files.Add(newFile);

        //uploadFile.Tag = ???

        cc.Load(docs);
        cc.Load(uploadFile);
        cc.ExecuteQuery(); 
    }

What do I set at uploadFile.Tag?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.