Posts

Showing posts from November, 2014

SharePoint Online: How do I set the Web.AlternateCSS property in CSOM?

The properties are only exposed in the '16' (SharePoint Online) version of the client side dlls. You will need to change your references to point to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll and C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll

C#: How do I store a secure password?

The eternal problems of encryption and data security is an ever present headache for all developers. This  post provides a great introduction to the problem. Fortunately, C# provides a very powerful Windows Data Protection API to resolve this issue. Read more about it  here  and find the sample code  here . Here is a simple extension method to achieve the required result: using System; using System.Security.Cryptography; using System.Text; namespace MyProject.Security {  public static class SecurityExtensions     {         private const DataProtectionScope Scope = DataProtectionScope.CurrentUser;         static readonly byte[] AdditionalEntropy = { 9, 8, 7, 6, 5, 4, 3, 2, 1 };         public static string Encrypt(this string plainText)         {             if (plainText == null) throw new ArgumentNullException("plainText");             var data = Encoding.Unicode.GetBytes(plainText);             var encrypted = ProtectedData.Protect(data, AdditionalE

C#: How do I generate a SecureString password?

There is a simple function to generate a secure string password:             public static SecureString StringToSecure(string password)             {                 var secure = new SecureString();                 foreach (char c in password)                 {                     secure.AppendChar(c);                 }                 return secure;             }

SharePoint Online: How do I brand my Sites, Subsites and OneDrive for Business Site?

The patterns for applying branding during site creation have changed, but fortunately, the Patterns and Practices team have provided some excellent guidance on how to resolve some common issues. Here are some of the links I have found very useful: Async site collection creation: https://github.com/OfficeDev/PnP/tree/master/Samples/Provisioning.Cloud.Async Sub site creation app: https://github.com/OfficeDev/PnP/tree/master/Samples/Provisioning.SubSiteCreationApp OneDrive for Business: https://github.com/OfficeDev/PnP/tree/master/Solutions/Provisioning.OneDrive