This blog is about SharePoint, Office365 and Office Development

Popular Posts

Walk-through: Create SharePoint 2013 Composed Look

In this post I will explain how to extend your design to support multiple looks and themes , so the site admin can easily change the color theme of your custom design.

  • Before going into the steps let's define the component of a composed look 
    • Master Page
    • SPColor File (Color palette File)
    • Font File (Font Scheme)
For the Master page it's well known for everybody is working with SharePoint or even any ASP.NET applications. Therefore, I will focus only on describing the other two  elements of the Composed Look:

The Palette

The color File or the color palette contains an XML representation of a 32-color based palette the definition of the palette will be as below 

The first three properties:
  • PreviewSlot1,2 ,3 Represents the 3 colors which represents this palette file and will appear next to the composed look in the Change the look page 
Hint: you can go to the change the look page by clicking site settings->Change the look

After navigating to change the look you will find all the OOTB composed looks listed if you selected any of them for preview  you can find the three preview color appears as below

after the three properties you will find definition of 32 different color slots each will have the RGB hexadecimal representation of a color like:

   <s:color name="BodyText" value="464646" />
    <s:color name="SubtleBodyText" value="030303" />
    <s:color name="StrongBodyText" value="222222" />
    <s:color name="DisabledText" value="CE9A00" />
    <s:color name="SiteTitle" value="222222" />

The Font

The font file simply consists of font slots and each font slot contains a specific font face for each script

based on the above information, in order to create composed look we need to 
  1. Define the unique colors and fonts you are using in your custom CSS and list them 
  2. Create new SPFile by defining the colors of you palette.
  3. Update CSS files and replace all the colors by placeholders contains the color slot name, sometimes it's even better to create single themable CSS files that overrides the color used in all other custom CSS like below
  4. Upload you custom master page to SharePoint master page gallery
  5. Upload your themable CSS file to the style library/language/Themable folder
  6. If you have multilingual site you need to upload the CSS file to the appropriate folder under Style library 
  7. Create Composed Look  by navigating to site settings->Composed looks
  8. Click on Add new to create new composed look
  9. Fill in the needed information
  10. Make sure that all composed look components are checked in and published 
  11. When you navigate back to the Change the look you can find your own composed look
  12. apply composed look and see the website color theme changes as you change the composed look.
  13. Make sure that your Themable Css is selected in the site master page settings->Alternate  CSS URL
Note: Sometimes the creation process of a composed look fails to save  when you select custom master page Url, the work around is to use OOTB master page and after change the look you can set your own custom master page.

Something went wrong with adding the app

When you deploy your app sometimes you can't update your app , some posts suggest to update the app version  from the AppManifest.XML file , unfortunately , It's not always working.

Quick fix for the problem is to update the app product ID using the following

  1. Open the AppManifest.xml
  2.  From the Tools menu open the create GUID tool
  3. Generate new GUID
  4. replace the product ID in the appManifest.xml file
now the app will be deployed with no errors.

Use Your App as Module Element

In this post I will explain how to use your SharePoint app as module element to copy files to particular location in the Host SharePoint site.

  1. Create new Application

  2. You will find that an application project has been created for you
  3. Go to  the App project properties
  4. For the property "Handle App Installed" and "Handle App Uninstalling" enable both of them

  5. Visual studio will confirm creation of an web project 
  6. After the new web application project has been created place all your files in the web application In my case I placed all the files under PageLayout folder
  7. In the  AppEventReceiver.svc you can find that a method has been created for you 
  8. In this method we will add the code to handle adding files as the application been installed and removing files as the application uninstalled
  9. When Application installed it copies all the directories and the files within the "PageLayout" folder to the master page library recursively
  10. You can download the Full source code from here