cancel
Showing results for 
Search instead for 
Did you mean: 

Graph Connectors (Outlook and Excel) Questions

john.hammond
Level 6
Afternoon all.

We're starting to experiment with Graph API and starting to get somewhere, particularly on the SharePoint side of things. Although I'm still having a few difficulties with some of the other connectors from the DX, and having searched for these issues I can't see them mentioned anywhere on these forums. Could just be me being extremely daft, but I was wondering if anyone could lend me a hand in understanding them a bit more:

 - In MS Graph - Outlook, I'm able to do most things, however the 'List Messages in Folder' action seems to only return a maximum of 10 items. I've seen similar responses in SharePoint, but that had a 'GetNextToken' output parameter which I could use, but I cannot see this here. Alternatively, there does appear to be the object 'List Messages' which does have a NextLinkToken output, however the format of the emails pulled using this object is nowhere near as pleasant as the other object - as in, the entire message with all headers and css/html tags are contained within a single string, making it difficult and inefficient to search, for example, a subject line.

 - With Excel, a bit of a more fundamental issue this one - how do you open a file?! I'm able to download a file, which I could then feasibly use the Excel VBO to do any manipulation that I require before uploading it again and deleting the old version, but this seems like a very haphazard way of going about things. I assume that I need to rub the object 'Create Session'? If so, could I have a bit more of a clearer explanation as to the Input Parameters needed to identify the relevant file? I assume that 'ID' is the Site ID with Workbook ID the ID of the Excel file itself (found via Get Drive Items in SharePoint)?

Many Thanks!

------------------------------
John Hammond
------------------------------
19 REPLIES 19

VitBlazek
Level 2

Hello John,

First get the download link by one of request bellow then use action Utility File management - Download File by URL and Destination Path.

[GraphApi - Path] & "/sites/" & [Site ID] & "/lists/{" & [List ID] & "}" & "/drive/items/" & [File ID] & "?select=id,@microsoft.graph.downloadUrl"

[GraphApi - Path] & "/sites/" & [Site ID] & "/drives/" & [Drive ID] & "/items/" & [File ID] & "?select=id,@microsoft.graph.downloadUrl"

V.

------------------------------
Vit Blazek
BluePrism Aplication Manager at CSOB,a.s.
Ceskoslovenska obchodni banka, a. s.
Europe/Prague
------------------------------

Thank you for your prompt response V. Can I just ask though, is there not a pre-determined action within the Connector to do this? And does this not just download the file, which could be done using 'Microsoft Graph - Download Files' from the DX and then the action 'Download from SharePoint'?

------------------------------
John Hammond
------------------------------

ewilson
Staff
Staff
Hi @john.hammond,

Regarding the List Messages in Folder action and GetNextToken, that's an oversight on our part. Luckily enough we've undertaken an exercise over the next month or so to see what we can do to redesign the Excel and Outlook connectors for Graph to make them more user friendly. It will take a little time, but in the meantime we'll get an update posted in the next day or so to address the paging issue in that action.

With Excel, yes you'll use Create Session to get your work started with a specific workbook. Check the embedded user guide on the connector for descriptions of the input fields.
7329.png
Cheers,​

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Thanks for this Eric, and good news about the Outlook connector. I'll keep my eyes peeled for that one.

As for the Excel documentation, I had looked at that, but I think it's just the last couple of parameters there that have confused me - For Workbook ID, I've navigated to the relevant folder using the SharePoint connector and have grabbed the 'id' value from that - so essentially, I'm treating 'Workbook ID' as 'File ID' - is that correct? Also, for the 'Type' parameter, I'm unsure what those values pertain to - whenever I try any of those suggested values (and assuming Workbook ID = File ID), stepping over the action returns this error message:

Internal : Unexpected error Cannot execute action "Create Session" because an error occurred while compiling custom code. Errors were found in the following locations:
Shared code

EDIT: Sorry to 'cross the streams', as it were, but I'm currently trying to configure 'Microsoft Graph - Sharepoint Upload Session' from the DX, but am getting a Compiler error (screenshot below). I've had a similar issue before, potentially down to the version of .NET framework we're running on. Am I OK to strip the dollar sign from this code? Only that when I do remove the character, I'm consistently presented with the following error message in the Response Body of the action 'Create Upload Session':
{"error":{"code":"BadRequest","message":"Resource not found for the segment '{folderPath}'.","innerError":{"date":"2022-08-23T14:19:44","request-id":"2e52c20c-e415-4092-a4fb-c0e7b769057d","client-request-id":"2e52c20c-e415-4092-a4fb-c0e7b769057d"}}}

7330.png

------------------------------
John Hammond
------------------------------

Hi @john.hammond,

That's an interesting error. The $ is a feature that was introduced in C# v6 back in 2015, I think, for string interpolation. I assume you're on .NET Framework 4.7 or later, correct? C# v6 was introduced as part of .NET Framework 4.6.​

You can remove it, but you'll have to change the whole string such that you'll be concatenating the parameters together with the string. Either that, or you can replace the $ with String.Format(). Here are some examples:

// Example 1: Concatenating parameters.
var url = "https://graph.microsoft.com/v1.0/sites/" + siteId + "/drives/" + driveId + "/" + folderPath + "/" + fileName + ":/createUploadSession";


// Example 2: String.Format()
var url = "https://graph.microsoft.com/v1.0" + String.Format("/sites/{0}/drives/{1}/{2}/{3}:/createUploadSession", siteId, driveId, folderPath, fileName);


Regarding the Type parameter in the Excel connector, this refers to whether you're trying to work with a spreadsheet that stored in a user drive, group drive, or SharePoint drive. If you take a look at the Microsoft Graph API you'll see they expose multiple endpoints for just about every action depending on the data you're trying to work with. So, as an example, if you wanted to worked with an Excel spreadsheet that was stored on a SharePoint site you would set Type to site. What this ends up dong behind the scenes is changing the underlying URL path that's used in the REST request.
 
Cheers,



------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

ewilson
Staff
Staff
Hi @john.hammond,

Version 2.3.1 of the Outlook connector for Graph was posted to the DX tonight. It includes support for the NextLinkToken output parameter on the List Messages in Folder action.​

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi @Eric Wilson, thank you for your swift response.

I do indeed see that the 'List Messages in Folder' action now has a NextLinkToken value returned, although it looks to me as if all response content is now compacted into a single field, much like how the 'List Messages' function did previously. I assume this has been done for reliability issues, but is there a 'legacy' version of what this action used to perform with the NextLinkToken parameter present? Or alternatively, is there perhaps a 'nice' way of unpacking this data?​

------------------------------
John Hammond
------------------------------

And thank you for this response also! I'll have a look at both of these at some point today.

EDIT: Sorry @Eric Wilson, sent another reply to you regarding a potential missing dll which I now cannot find (in relation to the Excel connector). Found the dll and put it in the BP folder, but was still getting the issue. Investigated the Common Code for the Excel Graph API call and was presented with this message, if you have any ideas?!

Also, just spoken to someone more in the know than myself, and apparently we might be using .NET framework 3.5 (!!!), which might be limiting my functionality somewhat.

7334.png

------------------------------
John Hammond
------------------------------

Hi again @ewilson.

That issue I was having RE: Shared Code when opening a file using the Excel API appears to be linked to a missing dll from the object on the DX - should Newtonsoft.Json.dll be mentioned as a prerequisite/download?​​

------------------------------
John Hammond
------------------------------