Solved

How to read and update data in a Sharepoint list using Foxtrot RPA

  • 7 January 2020
  • 7 replies
  • 148 views

Can anyone suggest the steps to read and update data from sharepoint list using botflow.

icon

Best answer by mbalslow 15 January 2020, 09:45

View original

7 replies

Hi @priyaes,


There are many ways of approaching this. First of all, it is relevant to consider what version of Sharepoint you are using as that dictates the available options.


Potentially, you could:


- Access; read, write, update data in Sharepoint lists using an API, which you can call either using the REST action or one of the programming actions like Python.


- Access your Sharepoint via the UI in a browser like you would manually, then you would build the steps of opening the browser, signing in, navigate to the list, and the perform the relevant steps using the bot like you would manually. Here, depending on the objective, you can apply different approaches. For example, if you want to read a lot of data, you could use the function in Sharepoint to export the list to Excel and then read the data from Excel.


 


So there are various options. It depends on your available options and the objectives. I have made plenty of solutions with both approaches.

Thank you for your sugesstion.I am using sharepoint online environment.


It will be help if you can share images of the settings for REST call for GET,POST method.


I tried the GET method but unable to read data.


Facing the below issue.


err nbr = 5 err desc = The remote server returned an error: (403) Forbidden.

Hi @mbalslow ,


Today I tried the approach of export to excel in sharepoint list.But I am stuck in the step to detect the save action.Can you let me know the best action that can be used to save or open the excel.I have tried targetting and mouse records both is not working.


Your thoughts will be helpful on this.

Hi @mbaslow,

Greetings for the day.Any thoughts on my below query.

Hi @priyaes,


 


Apologies for the late response - busy days...


 


To answer your different points:



  1. API call to Sharepoint Online

    • This is not possible with the standard REST action in Foxtrot, unfortunately, as it is not advanced enough. You will need to write a bit of code to get started. One way is to use Python and this package. If you have no to limited programming experience, this might be too complicated and complex. Of course, if you would like our assistance in implementing this, let me know. Here is an example snippet getting all the items of a list:
      from settings import settings
      from office365.runtime.auth.authentication_context import AuthenticationContext
      from office365.sharepoint.client_context import ClientContext


      ctxAuth = AuthenticationContext(url=settings["sharepoint_url"])
      if ctxAuth.acquire_token_for_user(username=settings["sharepoint_username"], password=settings["sharepoint_password"]):
      ctx = ClientContext(settings["sharepoint_url_site"], ctxAuth)
      else:
      print(ctxAuth.get_last_error())

      def get_data(list):
      list_object = ctx.web.lists.get_by_title(list)
      items = list_object.get_items()
      ctx.load(items)
      ctx.execute_query()

      data = []

      for item in items:
      data.append(item.properties)

      return data

      get_data("Name of your Sharepoint list")




  2. Saving the file after downloading it.

    • This is a standard scripting question. I made a very simple (no audio) video some time ago to another client illustrating how you would go about clicking to download a file and then save it using standard actions. Of course, how you click to download the file in the first place is a bit different on Sharepoint compared to the video, but the concept afterwards with the download bar should be the same.

    • Video: https://www.screencast.com/t/aUGqz9LVX



@mbalslow ,


 


Thank You, this perfectly suits my secnario.


Kudos to you.

Hi Priyaes,


 


I've a similar requirement for my project.


Tried to update the list item using REST API but was getting the error 403 and then i saw your post.


Just wondering if you would be able to share your solution. Not good with Python.


 


Thanks in  advance.


 

Reply