0

I am trying to use Blueprism to download pdf files from Sharepoint. I am using the below code. Url and Path are both variables which get passed through. This is producing a 403 forbidden error. I believe that Blueprism is required to pass credentials to Sharepoint before it will be allowed to download the file. Is this possible?

Using wc As New System.Net.WebClient()
wc.DownloadFile(Url, Path)
End Using
Eoin2211
  • 911
  • 2
  • 19
  • 39
  • Have you tried mapping the SharePoint site as a drive? Can you try the "Open in Explorer" SharePoint function? – Marek Stejskal Oct 04 '19 at 11:52
  • I haven't, but if I was to do this I think I would need to re map it every time the machine got restarted? – Eoin2211 Oct 04 '19 at 11:55
  • you wouldn't need to, if you map the drive using a command line (which you should) and the command being `net use` then you can specify that the drive is persistent. But even if you chose not to, you can use this command every time you restart the machine. – Marek Stejskal Oct 04 '19 at 12:01
  • I suppose in theory I could actually have the process map the drive each time. I just tried to map manually there and got an invalid error "Folder you entered appears to be invalid" – Eoin2211 Oct 04 '19 at 12:29
  • The path to the file may not be exactly the same as the folder path. Does SharePoint allow you to open the containing folder in Explorer? – Marek Stejskal Oct 04 '19 at 12:32
  • was it an access issue in the end? was this resolved for you? – Dexter Whelan Feb 10 '21 at 14:03

2 Answers2

1

I don't think you have a password related issue, likely the SharePoint is recognising your account access via AD group or SSO of some kind. 403 means the server has understood your request but is denying to fulfil it because of an access reason on the profile you have. Make sure you can manually download the file on the profile you are emulating for a start then also check the profile the bot is operating under (not necessarily yours in some cases ) has access to said file.

Literally 403 is a request that relates to an access issue so somewhere something doesn't have the correct access lined up

Dexter Whelan
  • 414
  • 3
  • 15
  • Exactly. See "401 vs 403" response code topic - https://stackoverflow.com/questions/3297048/403-forbidden-vs-401-unauthorized-http-responses – PeterDanis Oct 31 '19 at 07:18
0

First of all, is this a Sharepoint Online or OnPremises version? As you understand, you are connecting to web resource via an API and as such you have to get authenticated and authorized to access those resources.

If it's SPO, you can use the API component for SharePoint integration from DX and configure. In case of SP On prem, you have to customize a lot to achieve your results.