While recently working with one of my customers on configuring their Office 365 SharePoint Online Hybrid Mysite solution, we noticed some glitches to be aware of when pointing an on-premises farm (SP2010 and/or SP2013) directly to the
https://<tenantname>-my.sharepoint.com url as a Trusted MySite Host Location.
Yes the MySite/SkyDrive links will work fine...However certain operation like clicking on a users name under the "Modified By" column in an on-prem library
will fail with the following error
This is because SharePoint on-prem is passing the user context to Office 365 as accountname=DORADOJOES\elib
https://proseware-my.sharepoint.com/Person.aspx?accountname=Contoso\elib
rather than accountname=i:0#.f|membership|elib@doradojoes.com
https://proseware-my.sharepoint.com/Person.aspx?accountname=i:0#.f|membership|elib@contoso.com
To avoid this issue, you may want to implement a solution similar to the one below in which we provisioned a custom.aspx page (sample code below) in the on-premises SharePoint farm that performs a string manipulation against the accountname so its formatted properly before being passed to O365
- Drop that custom.aspx page into the Layouts directory on all on-prem SP servers,
- Then rather than pointing to https://<tenantname>-my.sharepoint.com url as a Trusted MySite Host Location, you point to http://<onpremMySiteHost>/_layouts/custom.aspx as the Trusted MySite Host Location instead.
NOTE: you will need to change <tenantname> to the actual name of your O356 tenant
ex. "https://contoso-my.sharepoint.com/Person.aspx?accountname="
<html>
<head>
<script language="CS" runat="server">
void Page_Load(object sender, System.EventArgs e)
{
try
{
string account = Request.QueryString["accountname"];
if(account != null)
{
// Extract domain and name of user from the account name
int stop = account.IndexOf("\\");
string domain = account.Substring(0, stop);
string user = account.Substring(stop + 1, account.Length - stop - 1);
// Construct the SPO URL to redirect to
string spoUser = String.Format("i:0#.f|membership|{0}@{1}.com", user, domain);
string spoUrl = "https://<tenantname>-my.sharepoint.com/Person.aspx?accountname=" + Server.UrlEncode(spoUser);
// Redirect to profile page in SPO
Response.Redirect(spoUrl);
}
}
catch
{
// Handle error as necessary
throw;
}
}
</script>
</head>
</html>
Go Cloud!!!