I want to read a .json file from Sharepoint like if I was using “read text” activity. The problem is I get the file from Sharepoint as a driveitem, and I can’t get an activity which would read that driveitem as a string.
Is there something I can do with that driveitem (which has the file I want) for be able to read its file as a text?
Hi @Pablo_Sanchez
Yes, it is possible. Here are the steps to achieve this:
1.Use the “SharePoint Application Scope” activity to connect to the SharePoint site where the file is stored.
2. Use the “Get Drive Items” activity to retrieve the driveitem that contains the JSON file.
3. Use the “Get File” activity to retrieve the JSON file from the driveitem. This will give you a “DriveItemFile” object that contains information about the file, including its content URL.
4. Use the “HTTP Request” activity to send a GET request to the content URL of the file.
In the properties of the “HTTP Request” activity, set the “Response” property to a variable of type “HttpResponseMessage”.
5. Use the “Read Text” activity to read the content of the JSON file from the response body of the HTTP request. In the “Read Text” activity, set the “Input” property to the “Response.Content.ReadAsStringAsync().Result” expression.
This will allow you to read the contents of the JSON file from the SharePoint driveitem as a string.