Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more: , +
I am using Provider-Hosted App. I want to get version collection of list item, for that just tried to access using list.asmx service. To call this SP service, have to pass cookie(FedAuth and rtFa). but i have only accesstoken with me, is any way to get cookie of the current logged in user?

What I have tried:

I have tried to call list.asmx service using HttpWebRequest with access token, it throws 401 exception. it ask for either cookie or credentials. (user already logged in the SharePoint site in browser, so i could not ask user to give credentials for this). so my better option to go with cookie.
Posted
Updated 9-Mar-16 15:14pm
v2

1 solution

Hi Just for clarity, with remote API s available , Can't u just call the API instead of using webrequests?

like below
var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);

using (var clientContext = spContext.CreateUserClientContextForSPAppWeb())
{
Web web = clientContext.Web;
clientContext.Load(web);
clientContext.ExecuteQuery();

ListCollection lists = web.Lists;
clientContext.Load<listcollection>(lists);
clientContext.ExecuteQuery();
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900