Downolad file from SharePoint

NikNiksNikNiks Member Posts: 3
Hi All,

I am trying to download file from SharePoint Online to NAV 365 BC 130 and if run following code I get an error. Upload file to SharePoint works fine but download file not. Please, Does anyone have experience with this, or could someone advise what is wrong and how to fix it? I'm really helpless now :(

Thanks a lot,
Dominik

igrozeguyyon.png

ClientContext := ClientContext.ClientContext('SITE URL');
Account := 'USER ACCOUNT';
SecureString := SecureString.SecureString();
Password := 'PASSWORD';
FOR i := 1 TO STRLEN(Password) DO BEGIN
SecureLetter := Password;
SecureString.AppendChar(SecureLetter);
END;
SharePointClientCre := SharePointClientCre.SharePointOnlineCredentials(Account,SecureString);
ClientContext.Credentials := SharePointClientCre;
String := 'FILE URL';
ClientFile := ClientContext.Web.GetFileByServerRelativeUrl(String);
ClientContext.Load(ClientFile,Expression);
ClientContext.ExecuteQuery;


ClientContext DotNet Microsoft.SharePoint.Client.ClientContext.'Microsoft.SharePoint.Client, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
NetworkCredential DotNet System.Net.NetworkCredential.'System.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
SharePointClientCre DotNet Microsoft.SharePoint.Client.SharePointOnlineCredentials.'Microsoft.SharePoint.Client.Runtime, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
ClientFile DotNet Microsoft.SharePoint.Client.File.'Microsoft.SharePoint.Client, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
SecureString DotNet System.Security.SecureString.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
String DotNet System.String.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Expression DotNet System.Linq.Expressions.Expression.'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Password Text
SecureLetter Char
Account Text





Answers

Sign In or Register to comment.