Bonaii
Bonaii

Reputation: 75

PnP.Core uploading to Sharepoint folder c# error 'To update this folder, go to the channel in Microsoft Teams'

I have a solution I created a little over a year ago that uses PnP.Core to upload file to a specific folder on SharePoint. It was all well until a couple days ago where that solution started generating error that says To update this folder, go to the channel in Microsoft Teams

I am at a bit of a loss as to why and what is causing this.

Below is a minimal code sample of what I have. I should mention that the folder is getting created but fails with said error when uploading the file to the folder.

Any pointers would be greatly appreciated.

authenticate using officeDev.PnP.Core.AuthenticationManager
...
 Folder Root_Folder = web.GetFolderByServerRelativeUrl(Root_Folder_Relative_Url_Path);

                    //Create new subFolder to load files into
                    string Folder_Name = _Folder_Name;
                    Root_Folder.Folders.Add(Folder_Name);
                    Root_Folder.Update();

                    //Add file to new Folder
                    Folder Subject_Folder = web.GetFolderByServerRelativeUrl(Root_Folder_Relative_Url_Path + "/" + Folder_Name);

                    FileCreationInformation Subject_Result_File = new FileCreationInformation {
                        ContentStream = new MemoryStream(_File_To_Upload),
                        Url = _File_Name,
                        Overwrite = true
                    };

                    Microsoft.SharePoint.Client.File uploadFile = Subject_Folder.Files.Add(Subject_Result_File);
                    Subject_Folder.Update();

                    Client_Ctx.ExecuteQuery();

Upvotes: 2

Views: 1175

Answers (1)

Bonaii
Bonaii

Reputation: 75

Looks like the Update method was the issue. Removing it and just letting the ExecuteQuery handle all the operation fixed it.

Upvotes: 2

Related Questions