Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

SharePoint Online CSOM Authentication Code does not working on Sandbox solution

$
0
0

Hi,

actually i need to customize public site and used custom login page for authenticated SharePoint Users.

i am follow below post :

 http://community.office365.com/en-us/forums/154/p/57156/207461.aspx#207461

and checked that we can accomplish authenticated using CSOM.  so i have used below code.

http://blogs.msdn.com/b/cjohnson/archive/2011/05/14/part-2-headless-authentication-with-sharepoint-online-and-the-client-side-object-model.aspx

here is code :

            string cmdSpoSite = "https://sharepoint-public.sharepoint.com/";
            string cmdUserName = "username@sharepointahm.onmicrosoft.com";
            string cmdPassword = "password";

            helper = new MsOnlineClaimsHelper(
                        cmdUserName,
                        cmdPassword,
                        cmdSpoSite);

            using (ClientContext ctx = new ClientContext(cmdSpoSite))
            {
                ctx.ExecutingWebRequest += new EventHandler<WebRequestEventArgs>(ctx_ExecutingWebRequest);

                if (ctx != null)
                {
                    ctx.Load(ctx.Web); // Query for Web
                    ctx.ExecuteQuery(); // Execute

                    lbltext.Text = ctx.Web.Title;
                    //Console.WriteLine(ctx.Web.Title);
                }
            } 

code is worked fine in console app. when moved on webpart of Sandbox solution it does not worked. but when i have used code on webpart in Farm Solution getting worked fine.

please guide we can used it or not?

Thanks




Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>