Announcements
Hello,
I'd want to import files (Excel) from Sharepoint and was wondering if there are any useful x++ documentations for working with files.
I'd want to do the following:
-Using x++, download a file(Excel) from SharePoint and extract data from it
-create folders In SharePoint.
-Place files in the sharepoint folder
-Generate a text file (.txt).
thank you.
In case any one want to get a file from sharePoint U need to use the namespace Microsoft.Dynamics.Platform.Integration.SharePoint
I wish this code help
using SP = Microsoft.Dynamics.Platform.Integration.SharePoint; class SPclass { ////// Runs the class with the specified arguments. /// /// The specified arguments. public static void main(Args _args) { System.UriBuilder builder = new System.UriBuilder("xxxxx.sharepoint.com/sites/mysite"); str host = builder.Host; System.Uri uri = new System.Uri("https://xxxxxx.sharepoint.com/sites/mysite/_api/web/" "GetFileByServerRelativeUrl('/sites/mysite/Documents partages/Fichier XLSX/IN/myfile.xlsx')/$value"); str extId = xUserInfo::getExternalId(); SP.SharePointProxy proxy = SP.SharePointHelper::CreateProxy(host,'/sites/mysite', extId); str token = proxy.AccessToken; SP.FileResults FileResults = new SP.FileResults(); SP.FileContents File; if(SP.SharePointHelper::VerifyAuthentication(proxy)) { //Method 1 memoryStream = SP.SharePointHelper::GetFiles(proxy,"Documents partages/Fichier XLSX/IN",""); System.Collections.IEnumerable results = FileResults.Results; var fileListEnumerator = results.GetEnumerator(); while (fileListEnumerator.MoveNext()) { SP.FileResult fileResult = fileListEnumerator.Current; } //Method2 File = SP.SharePointHelper::GetFileContents(proxy, Uri, true); } } }
I'm not sure what you mean by dotnet builtin packages, but you'll indeed need .NET in some way. Either you'll utilize the Dynamics libraries that Microsoft uses, or you'll use SharePoint libraries directly, or you'll use libraries for HTTP communication.
By the way, trying to avoid using existing Azure resources becomes less and less feasible. It will be wise if your customer learn how to use cloud resources rather then rejecting them. Not only that reiventing the wheel is expensive, but many things will become impossible, although they're rather easy if you utilize available tools.
thank u Andre Arnaud de Calavon
Because the customer does not want to operate with Power Automate or Logic Apps, I must use X++.
Hi Saoudi,
You describe a process where a file is taken from SharePoint, convert it to another format an save it again in SharePoint. Tools like Power Automate and Logic Apps will do the job more easily with configuration instead of development in Dynamics 365.
Thank u goshoom
I attempt to utilize them, but it's not that evident. Also I'd want to know where I can find any relevant information about working with files, as well as whether I need to use dotnet builtin packages.
Maybe you could reuse existing functionality for this purpose. Document management and electronic reporting support SharePoint.
For example, look at Docu::GetStorageProvider() (with DocuFilePlace::SharePoint). The provider is also used by ERFileDestinationSharePoint class.
André Arnaud de Cal...
294,157
Super User 2025 Season 1
Martin Dráb
232,930
Most Valuable Professional
nmaenpaa
101,158
Moderator