How bad does it stink that you can’t elevate to the application pool account in Office 365. It used to make things like cross site reads so much easier but from a security perspective totally makes sense it doesn’t exist. There really is no delegated replacement
you can make the process slightly less painless by using the relevant objects within an extension method off a ClientContext object. Here is the extension method:
public static ClientContext BuildImpersonatedClientContext(this ClientContext context, string username, string password)
{
SecureString secureStrPwd = new SecureString();
foreach (char x in password)
{
secureStrPwd.AppendChar(x);
}
SharePointOnlineCredentials credentials = new SharePointOnlineCredentials(username, secureStrPwd);
context.Credentials = credentials;
return context;
}
To use the method, just invoke it as such:
ClientContext impersonatedContext = new ClientContext("MyUrl").BuildImpersonatedClientContext("user", "password");
http://www.sharepointsecurity.com/sharepoint/sharepoint-development/runwithelevatedprivileges-in-sharepoint-online-office-365/