"Authenticate as a user" in Provider Hosted App


98% of our app works fine in mvc5 app this:

 [sharepointcontextfilter]
        public actionresult index()
        {
            var spcontext = sharepointcontextprovider.current.getsharepointcontext(httpcontext);

            using (var clientcontext = spcontext.createapponlyclientcontextforsphost())
            {

but in 1 scenario, task (not user) must access list , retrieve items, same error described here: http://tomaszrabinski.pl/wordpress/2013/03/18/sharepointonlinecredentials-and-msoidclil-dll-file-not-found-exception/

what correct way let app authenticate credentials (user@mycompany.dk, mypassword)?

thanks


jorgen

 spcontext.createapponlyclientcontextforsphost()

above code works if have use apponly policy, in 1 sense elevated privilege for app. 

but in your scenario , need useronly policy or app+user.

try below method , , see if works.

var clientcontext=spcontext.createuserclientcontextforsphost();

refer below link know more sharepointcontext handler.

http://hackingkart.com/leveraging-sharepointcontext-sharepoint-apps/

mark answer , if find helpful.



abu shaeeb



SharePoint  ,  Apps for Office and SharePoint  >  Developing Apps for SharePoint 2013



Comments

  1.  
    I am so fortunate to have attempted contacting hack.truth and his team These hackers has successfully hacked my partner's iPhone so that I can have access to every deleted messages on WhatsApp, Facebook and email. I really appreciate you my hackers and thanks to the people that recommended them to me contact them via. hack.truth77@gmail.com

    ReplyDelete

Post a Comment

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user