Authentication in SharePoint WS

Hi there.

We want to retrieve and show documents inside SharePoint 2013.
We are using a SP webservice for that:

The problem here is that we don't know how are we going to authenticate using the logged-in user inside Outsystems environment. The webservice configuration only has Integrated Authentication, and even if I put it to "Yes", the result of calling the webservice inside the app is "The request failed with HTTP status 401: Unauthorized."

Thank you.

João Martins

I had the same problem, 

the solution was to use the EnhancedWebReferences extension to autenticate. Works fine now.
I had the same problem, 

the solution was to use the EnhancedWebReferences extension to autenticate. Works fine now.
Can you tell me the steps to overcome my problem? I already added the reference for the EnhancedWebReferences, but I need help on how to use it. I'm new in Outsystems btw :)

Thank you.

For sure i can.
1 - Use the action SetWebReferenceURL and set the required parameters, in this case set the WebReferenceName with the value "Copy" and the URL with the same adress used to consume the WebService;
2 - Use the action SetWebReferenceCredencials with the credential (the parameter WebReferenceName should be "Copy", like in the previous action);
3 - Use the method of the copy Webservice, for example "GetItem";
4 - It should works fine after that steps.

PS.: My english is REALLY bad, forgiveme for any gramatical or language errors.
Thank you Felipe.
It worked, the service is no longer complaining about authentication issues. But just one more thing, I would like to pass the user credentials that is logged in inside the outsystems (web and outsystems now). Can we do this? Because now I had to put my credentials to test, but I would like to pass, like SSO.

Another issue, even if I don't have problems with authentication, the sharepoint service is not returning the document, at least when I try to use the Download to get the document stream, its empty. Since you said you had the same problem, can you tell me if I'm using the right SP2013 WS or is there any other WS that, by giving the URL, it returns the BinaryData of the document?

Thank you!

1 - If the credentials are the same as the required by the service you can simply create a Aggregate (the old simple query) and user the Session.UserID to get the logged user infos in the user entity (from the system). keep in mind that password will be encrypted and it can be a issue (since u will pass the encrypted pass to service it will return unauthorized error code). This problem is up to you, because we can't decryp the user password, you will need to use some logic to save and use the correct credentials.

2 - I use two methods to do what i need (list and download a file from sharepoint), first i use the GetListItems WebMethod to list the items in a folder. I just fill the ListName and the queryOptions parametters and i'm good to go. Then i use the GetItem WebMethod to recover the binary data from the especific file, and i put the result in the download component and it's all done.

Let me know if you have more issues, i'm glad to help.
Thank you Felipe!
It worked.

Glad to help João, let me know if you need something.