kamagra how much to take

RunWithElevatedPrivileges In SharePoint Online / Office 365

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. As a result you are relegated to knowing the actual account name and password, which is annoying, Either way, 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:

  1. public static ClientContext BuildImpersonatedClientContext(this ClientContext context, string username, string password)
  2. {
  3. SecureString secureStrPwd = new SecureString();
  4. foreach (char x in password)
  5. {
  6. secureStrPwd.AppendChar(x);
  7. }
  8. SharePointOnlineCredentials credentials = new SharePointOnlineCredentials(username, secureStrPwd);
  9. context.Credentials = credentials;
  10. return context;
  11. }

 

To use the method, just invokeĀ it as such:

  1. ClientContext impersonatedContext = new ClientContext("MyUrl").BuildImpersonatedClientContext("user", "password");
Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>