Get list items attachments only gives me the name of the file

Hi all,

I thinked to use a “Get list item attachements” to read content of the excel files that users attach to a Sharepoint list elements, but, once added the activity, I’ve constated that I only obtain the name of the excel (no path, no options to save it locally on the computer…so impossible to use this on a “Read cell” activity for example):

I’ve also tried to insert the complete URL of the sharepoint stored file (Assigned to variable “ExcelFile”: “http://ouraddress:port/SFREQUEST/Lists/NEW TECHNICAL PROJECT/Attachments/1636/” + obtained name of the excel and used the variable on the Read cell Workbook activity) but the I obtain the rror:
image

Someone knows how we can interact with the excel attached without opening Sharepoint web page?

@Airun If you’re trying to download a file, Have you tried using the Get File Activity from the Sharepoint Activities Package ?
image

1 Like

Thanks @supermanPunch ! As I was working with a Sharepoint List I don’t thinked to look on “Library” activities.

It works more or less, it download the file and save it in my local folder, but I can’t open the file :sweat_smile:

From Uipath I have this error:

And opening it manually:

I think it’s because of the Sharepoint password protection, when we open the file normally since the request, we are requested to insert our Sharepoint/Windows credentials and put the file on edit mode. Is there any way to skip or perform those two steps with the sharepoint activities package? :thinking:

@Airun After logging in to the Sharepoint, do you have another set of credentials to access the Excel file which is not the same as that which you provide in the Sharepoint Scope ?

Also can you try changing the file type to xls and check if it opens up ?

1 Like

I have another set of credentials but those are the same, my Windows Credentials.
I’ve not tried to change the file tipe, maybe it could worked, but with help of my manager, we have found a way to download the file without issues (and after if we open the downloaded file since local folder it don’t requests credentials or to pass it to edit mode). I have used an “Invoke Code” with a part of code that had my manager to interact with our sharepoint lists, I’ve replaced some data by In arguments and it just work fine! It works perfectly and it’s very fast! :star_struck:

image

This is the code (in case of someone wants to use this solution, I’ve marked the things to replace between asterisks (**), the ones that starts by “IC_” are the arguments, the only thing that we’ve inserted with static text on the code is the URL of the Sharepoint site because for us is always the same for all requests for all teams):

    Dim context As New ClientContext(**"http://our.sharepoint.url:port/SUBSITENAME"**)
    Dim web As Web = context.Web

    Dim collList As ListCollection = web.Lists

    Dim oList As List
    Dim existe As Boolean

    existe = False

    ' Carga las listas del site GMC
    context.Load(collList)
    context.ExecuteQuery()
    For Each oList In collList
        If oList.Title = **IC_ListName** Then
            existe = True
            Exit For
        End If
    Next

    If existe Then
        Dim query As New Microsoft.SharePoint.Client.CamlQuery
        Dim itemList As ListItemCollection = oList.GetItems(query)

        context.Load(itemList)
        context.ExecuteQuery()
        Dim oItem As ListItem
        Dim existed As Boolean
        existed = False
        For Each oItem In itemList
            If oItem.Id = **IC_ID** Then
                existed = True
                Exit For
            End If
        Next

        If existed Then
           Dim client1 As New System.Net.WebClient
    client1.UseDefaultCredentials = True
    client1.DownloadFile(**IC_FileURL** , **IC_LocalFolder**)
			End If
			
    End If
	Console.WriteLine("Archivo descargado!!!")
1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.