Sep 03 2020 04:16 PM
I am migrating a project from a standalone SharePoint to one that is integrated with Teams. My application currently downloads an XML file and may checkout and upload and check in.
the current code to download does not work with the Teams SharePoint, i get 403 Forbidden errors.
public static XmlDocument GetConfig(string fileUrl)
{
Uri fileUri = new Uri(fileUrl);
string server = fileUri.AbsoluteUri.Replace(fileUri.AbsolutePath, "");
string serverrelative = fileUri.AbsolutePath;
XmlDocument doc = new XmlDocument();
try
{
Microsoft.SharePoint.Client.ClientContext clientContext = new Microsoft.SharePoint.Client.ClientContext(server);
Microsoft.SharePoint.Client.FileInformation f = Microsoft.SharePoint.Client.File.OpenBinaryDirect(clientContext, serverrelative);
clientContext.ExecuteQuery();
doc.Load(f.Stream);
return doc;
}
catch { }
return null;
}
any suggestions?
Sep 04 2020 07:52 AM
Sep 08 2020 05:05 AM
@SteveAZ395, can you please help me understand which url are you passing in parameter?