Louis-Charles Gagnon Blog

Microsoft Azure, Office 365 and SharePoint Blog

How to bypass the Office 365 login page when you have SSO in your organization

ADFS helps you use single sign-on (SSO) to authenticate users to multiple web applications over the life of a single session. This is accomplished by securely sharing digital identity and rights (Claims) across security and enterprise boundaries.
Office 365’s single sign-on capabilities with ADFS are a great improvement over dual-identities, and it takes online users a step closer to the seamless experience they have become accustomed to with an on premise web application.

But, once you’ve got it all hooked up you quickly find a couple of unexpected “features” that can ruin your user experience.

If you use one of the desktop applications (Outlook, Teams, Skype) or other application and link to a ressource that is on Office 365, if the user is not already logged in Office 365, he will be presented with the following login screen.



In order to bypass this link when you have the link follow the following url:
https://login.microsoftonline.com/login.srf?wa=wsignin1.0&whr=mydomain.com&wreply=https%3A%2F%2Fmyurl.sharepoint.com/

The mydomain.com is the name of the domain of your email (ex.: myname@mydomain.com). The wreply is the resulting url.

This allows seamless navigation from outside office 365 to within with your organisation SSO/ADFS.

Hope this helps.

Louis-Charles Gagnon, http://www.ls2.ca

How to remove "Get Started with your site" from a Team Site - Sharepoint 2013/Online

When you create a new team site on SharePoint 2013 and SharePoint Online, you are presented with a default "welcome" webpart: 


In order to remove this webpart, you may use the client context with the following code:            

Using SharePoint Dll:

          var web = clientContext.Web;
          clientContext.Load(web);

var web = clientContext.Web;

var file = web.GetFileByServerRelativeUrl(web.ServerRelativeUrl + "/SitePages/Home.aspx");

var wpm = file.GetLimitedWebPartManager(PersonalizationScope.Shared);

web.Context.Load(wpm.WebParts, wps => wps.Include(wp => wp.WebPart.Title));

web.Context.ExecuteQueryRetry();


for(var i=0;i<wpm.WebParts.Count;i++)

{

    if (wpm.WebParts[i].WebPart.Title.Equals("Get started with your site"))

    {

        wpm.WebParts[i].DeleteWebPart();

        web.Context.ExecuteQueryRetry();

    }

}




            var web = clientContext.Web;
            clientContext.Load(web);
            web.Context.ExecuteQuery();
            web.DeleteWebPart(web.ServerRelativeUrl + "/SitePages/Home.aspx", "Get started with your site");
            web.Context.ExecuteQuery();

In order to change the default homepage of a team site, here is the code:

            var web = clientContext.Web;
            var rootFolder = web.RootFolder;
            clientContext.Load(web);
            clientContext.Load(rootFolder);
            rootFolder.WelcomePage = "/SitePages/MyHomePage.aspx";
            rootFolder.Update();
            clientContext.ExecuteQuery();