Welcome

Sharepoint lead is a place where you can read about interesting topics related to sharepoint, and you can also post comments and suggessions.

Wednesday, July 4, 2012

Not able to change page layout


Problem:
Due to some problem in page, Page Layout button in ribbon is showing disabled.
Solution:
Use following as QUICK solution if you are creating a new page:
  1. Delete newly created page
  2. Go to site settings > Page Layouts and Templates
  3. Locate "New page defualt settings" and select the page layout that you want to set as default page layout.
  4. Save setting
  5. Create new page
There can be many reasons of Page Laout showing disabled in ribbon. You can reference following links to go deeper and resolve it properly.
  1. Try check out the page and then go to edit mode of the page.
  2. Try different browsers to change page layout
  3. ​Change page layout using powershell
  4. Reference link 1​

Monday, July 2, 2012

SMTP4DEV: Your sharepoint 2010 out going email server for development farm

If you are having standalone sharepoint 2010 development farm on window7 64bit, and looking for good option,  SMTP4DEV. It is a free tool. You will need around 10mins and then you can start receiving emails from sharepoint farm! Here are quick steps:

  1. Download  SMTP4DEV from it's codeplex project site, I prefer standalone exe but you can download installer as well.
  2. If you like to use some custom local domain, click on options and set up some local domain like local.machinename.com. Create host entry pointing to 127.0.0.1
  3. By completing these many steps you can now send emails through  SMTP4DEV by any url ending in @local.machinename.com
  4. Go to sharepoint central administration > System settings > setup outgoing email server.
  5. set local.machinename.com as server, and provide any email ending in @local.machinename.com 
  6. Save your settings
After these minimum set of configuration you will be able to start sending emails. Beauty of SMTP4DEV is:
  1. It will show you notification that new email is sent
  2. It will show you all emails sent from the smtp in UI without actually sending it
  3. You can inspect email
  4. You can view email (in email client that you set default)
So, in conclusion, it is a best choice KISS kind of solution for your sharepoint 2010 development farm's outgoing SMTP server.




Sharepoint 2010: TryGetList vs GetList

As a developer, you will say GetList can throw exception but TryGetList will not. It is actually confusing because TryGetList looks for listTitle and returns null if list is not available at expected location. GetList will expect listUrl and can throw FileNotFoundException or ArgumentException if list is not present at expected location or relative/absolute url of list is invalid relatively. Another biggest difference is they belong to different class!


Apart from all those technical details, I noticed that many sharepoint administrators likes to start with a simple list/library name and eventually change it to make it as close as possible to what they do. That will make list/library url and their names different. Here comes the actual problem. If you are actually using list/library names in your code, it will no longer work. OR we can say you are not allowing sharepoint administrators to change name of list/library that they have created. 


By using GetList you are actually giving them flexibility to use whatever name they like to use, as far as they are not changing url or list/library code will still work.


In conclusion, it really depends on requirements how you are going to deal with the situation but it is good to keep in mind that you can use GetUrl function in your code to allow sharepoint administrators to change their names without worrying about breaking functionality.