Home / Infrastructure and Networking / Rules to Better SharePoint

Rules to Better SharePoint

Hold on a second! How would you like to view this content?
Just the title! A brief blurb! Gimme everything!
  1. Do you know why you should use "Open with Explorer" over SkyDrive Pro?

    ​​​

    ​Watch Adam Cogan explaining why you should use "Open with Explorer"​ over SkyDrive:

     
  2. Do you know how to view changes made to a SharePoint 2013 page?

    ​Watch the video which explains how to view the version history for a page in SharePoint 2013. This allows you to see changes that were made to the page, as long as versioning is enabled in advance.

    ​​​​​

  3. ASP.NET vs SharePoint development - do you know what you get for free out of the box?

    SharePoint as a platform on top of ASP.NET gives you many components that you don’t get from ASP.NET out of the box:

    • WYSIWYG editing (IE only, no FireFox)
      SharePoint’s rich text editor works really well with IE out of the box, works with SharePoint image libraries, and supports many features and even allows site style configurations to define and restrict styles that can be applied in the site. Unfortunately, it is not a cross browser compliant WYSIWYG editor.
      In ASP.NET there are many 3rd party options here – but you won’t get the integrated support that SharePoint’s editor has, without doing further customization.
    • Content Version Control (with Publish and Approval workflow)
      SharePoint gives your end users content version control – they can update their pages and check-in to share it with the team, or publish it for everyone to see. Workflows can be attached to notify the necessary internal reviews.
      SharePoint also tracks changes across versions (except in web part zones), and allows users to compare between different versions.
      In ASP.NET this is not available – you will need to do significant work to achieve this behaviour, or build on top of another ASP.NET platform.
    • Permission Control (just assign to Groups)
      SharePoint allows items to be assigned to permission groups and works very well with Active Directory (or other membership providers) directly.
      In ASP.NET site permissions can be specified via web.config but the UI to configure parts of the site is limited.
    • Creating a subsite (simple and then appear in menus, breadcrumbs…)
      End users can create subsites in SharePoint that automatically appears in menu navigation and has all the correct breadcrumbs wired up. Subsites forms the necessary site navigation within SharePoint.
      In ASP.NET end users can not create subsites – developers has to do this.
    • Spell check
      SharePoint editor web parts come with spell check abilities.
      ASP.NET does not have equivalent – though many browsers now support a client-side spellchecking facility, and some 3rd party rich text editors also have spell check.
    • Search (filtered by your permissions) – google only works for anonymous
      SharePoint comes with a highly configurable enterprise search facility. The search result is filtered based on the current user so SharePoint will never show results that you aren’t supposed to see.
      SharePoint search can index Office documents as well as other popular document formats like PDF.
      Search engines like Google performs well for public content, but there is no way for the search crawler to index inside your organization. SharePoint uses its own internal crawler to keep your site’s content up to date in the search results.
    In ASP.NET - this is often overlooked – most ASP.NET search facilities are limited to only specific kind of data: e.g. search clients with the ID of SSW

  4. Do you know how to sort in view by a column through code

    ​​​You may know that it is quite easy to sort view by a column through the UI.
    SortInView.png
    Figure: Change view column ​sort from web UI
    But when you are trying to do that via code, you may find a pretty tricky issue.
    You can use some code like:

    view.Query = "<OrderBy><FieldRef Name=\"Modified\" Ascending=\"FALSE\" /></OrderBy>";

    Figure: Use code to change view sort
    but the below code won't work:

    view.Query = "<OrderBy><FieldRef Name=\"Modified\" Ascending=\"False\" /></OrderBy>";

    Bad Example - the Ascending attribute is case-sensitive
    The full code should be some code ​like:

    SPView view = list.DefaultView;
    view.Query = "<OrderBy><FieldRef Name=\"Modified\" Ascending=\"FALSE\" /></OrderBy>";
    view.Update();​​​​

    ​Good Example - the Ascending attribute is using capital charactors as it is case-sensitive
                     
                        
                        

  5. Do you know how to custom styles for RichHtmlEditor in SharePoint 2013?

    ​​​​​​As a CMS system, it's obviously necessary to apply standard styles to all content, so the whole site looks consistent.


    This rule outlines how to use custom styles in the SharePoint  RichHTMLEditor​.


    In SharePoint, we can use the below way to apply custom styles:

    CustomStylesInSharePoint.png
    Figure: custom RichHtmlEditor styles give your content editors a visual preview of your custom styles​


    ​To do this:

    1. You can use "PrefixStyleSheet" property to apply the custom styles to a build-in RichHtmlField in page layout or master page. In my case, I applied them to a custom control "ParsedRichHtmlField" which inherited from the system build-in one.


    <SSW:ParsedRichHtmlField PrefixStyleSheet="ssw15-rte" CssClass="ssw-inputeditorfield" id="Content" FieldName="PublishingPageContent" InputFieldLabel="Rule Summary Info" runat="server"/>


    2. Refer an additional css file in the page layout or master page (apply to display mode content).

       <SharePointWebControls:CssRegistration ID="CssRegistration3"   Name="Themable/ssw.core.styles.v15.css" runat="server"  EnableCssTheming="True"

          />


    3. Refer the additional css file again in "edit mode" in the page layout or master page (apply to edit mode editor).

    <PublishingWebControls:EditModePanel ID="EditModePanel1" runat="server">

    <!-- Styles for edit mode only-->

    <SharePointWebControls:CssRegistration ID="CssRegistration2" name="<% $SPUrl:~sitecollection/Style Library/~language/Themable/Core Styles/editmode15.css %>"

     After="<% $SPUrl:~sitecollection/Style Library/~language/Themable/Core Styles/pagelayouts15.css %>" runat="server"/>

            <SharePointWebControls:CssRegistration ID="CssRegistration3"   Name="Themable/ssw.core.styles.v15.css" runat="server"  EnableCssTheming="True"

                 After="<%$SPUrl:~sitecollection/Style Library/~language/Themable/Core Styles/editmode15.css  %>" />

    </PublishingWebControls:EditModePanel>

    Use "After" property to ensure that it will be loaded after the "editmode15.css", which is SharePoint default edit mode style. The custom style css file will be applied to the ribbon after users change to edit mode.


    4. Add your custom styles definitions into the additional css file, all styles' names should start with the value you set for PrefixStyleSheet, in our case, it's "ssw15-rte". The custom styles can be applied to different areas (cases) in the ribbon.

    1) .ssw15-rteLanguage - As SharePoint support multiple language, this definition will tell SharePoint which language will use those custom styles.

    e.g.

    .ssw15-rteLanguage-en {

        -ms-name: English;

    }

    2) .ssw15-rteElement - tell SharePoint which element will be applied with this style. When you press "Enter" in SharePoint editor, it will automatically start a new paragraph with "<P></P>", so it's a brilliant choice to make some custom "paragraph" elements.

    e.g.

    P.ssw15-rteElement-CodeArea

    {

    -ms-name:"Code Area";

    border: solid #CCC;

    border-width: 1px 1px 1px 10px;

    background: #EEE;

    padding: 5px 10px;

    margin: 8px;

    overflow-x:auto;

    display:block;

    width:93%;

    font-size:12px;

    }

    This Code Area style will come up in "Page Elements" section:​

    CodeArea.png
    Figure: Code Area style come up in "Page Elements" seciton


    While applying a "Page Elements" style, it will


    • Remove all the styles for the children elements
    • It may change both the class name and the parent element type, it depends on which html element has been specified in the definition.

    For example, we change the style 

    from 

    P.ssw15-rteElement-CodeArea

    to

    dd.ssw15-rteElement-FigureGood


    Its html code will change 

    from

    page_element_p.png
    Figure: "Code Area style" with parent element <p>

    to

    page_element_dd.png
    Figure: "Good Figure style" changed the parent element from <p> to <dd>

    3).ssw15-rteStyle - this style could be applied to Text Styles:


    e.g.

    .ssw15-rteStyle-Highlight

    {

    -ms-name:"Highlight";

    background-color: #FFFF00;

    }

    This Highlight style will come up in "Text Styles" section:​

    HighLight.png
    Figure: Highlight style will come up in "Text Styles" section​

    While applying a "Text Styles" style, it will


    • nest the text in a <span> tag with the style class if the text is not already inside an HTML tag
    • replace the class of the HTML tag if this tag is a <span> tag


    That means all "Text Styles" will apply to <span> tag, and you cannot apply two "Text Styles" to one <span> (e.g. apply both Strike and Hightlight), you may have to do that via changing html source code manually, or creating a "combined" "Text Styles".


    4) .ssw15-rteTable - Tell SharePoint the definition of custom table styles. After inserting a table, you can see the styles under "Design" tab:​



    e.g. The below is a "SSW Table" style definition:

    .ssw15-rteTable-default

    {

    -ms-name:"SSW Table";

    border:1px solid #ddd;

    margin: 8px;

    width:98%;

    background-color:#f0f0f0;

    }


    After finishing the definitions of custom styles, make a package and deploy to a SharePoint site, Create a page using the page layout or master page which you added custom RichHtmlField style, then you should be able to see the custom styles in the ribbon.


    Enjoy!


  6. Do you know how to resolve the broken links caused by page renaming?

    ​​Renaming pages in SharePoint site will cause broken links. All requests to the old URL will be responded to ​with a 404 error.

    Options to resolve this issue are:

    • ​Add a page every time for a rename…. add a JavaScript or META tag redirect to the original page​
    • Use custom 404 page to look at a list in SharePoint, the list contains all the renaming records, the records are automatically maintained via page updating events handler. (We are using this way) 
    • Wait for MS to fix the problem - support classical alternative links for a page.​ 

     


     

  7. Do you use the right service in SharePoint 2013

    ​​​In SharePoint 2010, you can use SharePoint service /_vti_bin/listdata.svc to access data in SharePoint list, but in SharePoint 2013, /_vti_bin/listdata.svc has been officially deprecated.

    The new service in SharePoint 2013 is http://server/site/_api/web/lists/getbytitle('listname')​
  8. Never Dispose Objects from SPContext.Current

    ​Disposing objects in SharePoint is important, but never do it with objects from SPContext.Current. SharePoint will manage disposing these objects itself.​

    using (SPWeb web = SPContext.Current.Site.RootWeb)
    {
     //do something here
    }

    Figure: Using statement is trying to dispose current site object - it will cause exception

    Just simplely use "Current" object directly.

    SPWeb web = SPContext.Current.Site.R​ootWeb​;
    //do something here

    Figure: Use Current objects directly - don't need to dispose them
  9. Do you use Access Request on your SharePoint site?

    Instead of displaying a direct "Access Denied" warning info, you can allow end users to send an "Access Request".
    PermissionRequest.jpg
    Figure: Joanna is requesting access to SharePoint site

    ​The "request manager" will receive an email:

    RequestNotificationEmail.png
    Figure: Request Notification Email Sample
    The link in the email will navigate administrator to the Pending Requests list:
    LinkToPendingRequestsList.png
    Figure: Pending Requests List

    After reading the request infomation, the administrator can "Approve" or "Decline" the request, o​r he can start a conversation with the request user on the Pending Requests list directly to inquire more information:

    StartAConversatioinOnPendingList.png
    Figure: possible actions for requests (Approve, Decline or start a conversation with the request user)


     

    To setup permission request for a SharePoint site collection, go to "Site Settings (Gear Wheel icon) | Site Permissions":

    SetupPermissionRequest.png
    Figure: Open "Access Request" setting


     

    ​​​​Limition:
    This "Access Request" only works for authenticated users to inquire more access permission, that means if your site allows "anonymous access", then an anonymous user cannot send "access request" as he doesn't have an identify to be assigned more access permission​.


     

  10. Do you know how to create a link to a URL in SharePoint?

    ​You may need a link in a SharePoint document to help you navigate to a different URL (like shortcut in Windows), there are different ways to implement this.

    A. ​Create a shortcut in windows, then upload the shortcut file (.url) to the document library.
    B. Use "Link to a document" content type in SharePoint.

    Step details:​

    A. Create a shortcut in windows, then upload the shortcut file (.url) to the document library.​

    To do this, you need to remove .url file type from your blocked file types in your web application. This will bring some security risk, which is not recommended, and I won't show the step details here.

    B. Use "Link to a document" content type in SharePoint.

    1) Enable "Content Type management"​ in your document library.

    EnableContentTypeDocument.png
    Figure: Enable Conent Type management in library setting

    2) Add "Link to a Document" content type into the library.

    AddExistContentType.png
    Figure: Add from existing site content type
    SelectLinkToADocumentType.png
    Figure: Select "Link to a Docuemnt" content type

    3) Create a "Link to a docuemnt" instance

    CreateLinkToADocumentInstance.png
    Figure: select "File | New Document (dropdown) | Link to a document"
    InputLinkUrlAndName.png
    Figure: Input "Name" and "URL"

    ​4) Done

    You should be able to see the link type document in your library:

    LinksTypeDocumentsWithShortcutIcon.png
    Figure: Link type documents with the lovely shortcut icon


  11. Do you clean useless calendars in SharePoint?

    Most SharePoint site templates contain a calendar list, this will bring lots of useless calendars.

    ​Use the below PowerShell script to clean them:​​

    $site = Get-SPSite("http://<site collection URL>/"); # Specify url here​
    ​foreach ($web in $site.AllWebs) {    ​
        $lists = $web.Lists
        for ($i=($lists.Count-1);$i -gt 0; $i--) {  
            $list = $lists[$i]
            #Write-host $i  $list.Title $list.BaseTemplate.ToString()
            if ($list.BaseTemplate.ToString().ToLower().contains('events')) {      
                if ($list.Items.Count -eq 0)
                {​
                    Write-Host $list.Items.Count "items in the list" $list.Title '('$list.BaseTemplate') at '$web.Url "- cleaning it!"
                    $list.Recycle()
                    #$list.Delete()
                }
            }
        }

    This script will put the calendars which do not have any events into Site SettingsRecycle Bin:

    EmptyCalendarsInRecyckeBin.png
    ​Figure: Empty Calendars in Recycle Bin folder


  12. Why do we use VM for SharePoint development?

    All SharePoint customization and development must be done on a Virtual Machine.

        

    1. It's very important to correctly setup a SharePoint environment for development. Correctly configured, this will save you a lot of trouble later on.
    2. From time to time, you can seriously damage a SharePoint installation during development and it is best not to install SharePoint on your everyday working machine. Additionally, when you start a new SharePoint project you don't want to carry all the luggage from a previous customization that could potentially affect your new project.
    3. Virtual machines can be fired up and shut down easily
    4. Virtual machines can be relocated on a different server and thus it doesn't waste developers' own computer resources
    5. Virtual machines can be copied and brought to a client for demostration.
    6. Very easy for someone to quickly create a new SharePoint server to quickly test or experiment with SharePoint.
    7. Bad: There might be more work required to activate additional servers.
  13. Do you know that you need to migrate 'custom site template' before upgrade to SharePoint 2013 UI?

    If you have “custom site template” for  your site, you can’t upgrade your site to the SharePoint 2013 UI unless you have a site template with the same name ready for new UI.

    missingSiteTemplateError.jpg

    Figure:SharePoint will show you an error “Missing Site Templates” that prevents you from upgrading

    ​To fix this issue

    1. Upgrade your site template’s content files and definition XML file to SharePoint 2013 (refer to SharePoint 2013 default site template for details).
    2. Package the site template’s content files to map location “{SharePointRoot}\Template\SiteTemplate”.
    siteTemplateStructure.jpg 
    3.Package the site template’s definition XML file to map location “{SharePointRoot}\TEMPLATE\1033\XML”.

    siteTemplateDefinitionFile.jpg 

    4.Deploy the package.
    5.Try to upgrade to SharePoint 2013 UI again.


  14. Do you add stsadm to environmental variables

    In SharePoint 2007, it is a good idea to add the path to stsadm.exe into the environment variables on a SharePoint server so you can open a command prompt and run the tool from anywhere.


    Figure: you should be able to quickly type ‘stsadm’. Believe me you will be typing it enough!In SharePoint 2010, you can skip quite a few steps by using the PowerShell Console.


    Figure: Using SharePoint 2010 Management Shell

    More Information for SharePoint 2007

    1. In the start menu type Edit the system environment variables and run the tool 
      Figure 1 - Search for "Edit the system environment variables” in the Start Menu
    2. In the System variables section, select Path and click Edit
       
      Figure 2 - Under System Variables | Select Path | Click Edit
    3. Add the path at the end of the Variable Value
      1. For a SharePoint 2007 Server, enter:
        ;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin
    4. You may need to reboot the server
    5. You can now run stsadm from anywhere in the command prompt

             

  15. Do you know how to delete orphaned users from the People Picker?

    The SharePoint "People Picker" is a great tool for quickly selecting users of your SharePoint site. It allows you to quickly select users from your organization by browsing Active Directory.

    Figure: The People Picker

    Unfortunately, if you have added users directly to your site collection, and later deleted or disabled them from Active Directory, you will notice that these orphaned users will still appear in your People Picker. This will eventually clutter up your People Picker.


    Figure: A user in the People Picker that was deleted from Active Directory
    Figure: Searching in Active Directory for the user shows the user is in fact deleted

    To remove these orphaned users, as a SharePoint Administrator, you can open the following URL (where www.northwind.com is your SharePoint URL):

    • http://www.northwind.com/_catalogs/users/simple.aspx

    On this page you will find a list of all the users that are members of your site collection, including the orphaned users.


    Figure: We have found our orphaned user!

    To remove the user simply click on the Username | Click Delete User from Site Collection. This will instantly remove the user from the People Picker.

  16. Do you advise staff members you are about to perform a migration

    Email the staff members advising a migration is about to take place and they will not be able to check in or edit documents, and should expect errors if they do so.

     
    Figure - Send your staff an email warning of the outageDo you know how to send a good network outage email?

  17. Do you know that developers should do all their custom work in their own SharePoint development environment?

    This is to prevent their work affecting other developers. During development, you can expect many of these things to happen:
    • IIS resets may need to be done frequently, which stops the SharePoint website working.
    • Custom webparts can easily introduce memory leaks which can stop SharePoint working.
    • You may be running development SharePoint in debugging mode which would hold the server thread.
    • You may be reading event or error logs that are being polluted by other developers simultaneously.

    Thus, all SharePoint customization and development must be done on a Virtual Machine. No ifs, no buts.

    1. It's very important to correctly setup a SharePoint environment for development. Correctly configured, this will save you a lot of trouble later on.
    2. From time to time, you can seriously screw/damage a SharePoint installation during development and it is best not to install SharePoint on your day-to-day machine.
    3. Additionally, when you start a new SharePoint project you don't want to carry all the baggage from previous customizations that could potentially affect your new project.

     

    There are many other benefits of using a virtual machine for development

    1. Virtual machines can be fired up and shut down easily
    2. Virtual machines can run faster, via being located on a different server and thus it doesn't waste developers' own computer resources
    3. Virtual machines can be copied and brought to a client for demonstration or testing
    4. They are the best way to quickly test or experiment with something new
    5. Virtual machines can frees up resources on the host, so it doesn’t waste resource when developers are not working on SharePoint
    6. Virtual machines can be easily cloned to scale up the development team
    7. Virtual machines enable developers to work in Windows Server 2003 / 2008 environment so they will be aware of the configuration issue when deploying to staging and production

    There are few consideration when using Virtual Machines:

    1. Need to activate additional servers
    2. Need at least 2 GB of RAM for SharePoint 2007
    3. Need at least 4 GB of RAM for SharePoint 2010
    4. Virtual PC does not support 64 bit Operating Systems 
      • If you’re using Windows 7 or Vista, we recommend using ‘boot to VHD’ or VMWare

    If you are after a clean, pre-configured SharePoint server image to test SharePoint, the easiest way is to download a trial VM from Microsoft

    More info on setting up SharePoint VM
  18. Do you know the ASP.NET skills that translate?

    Microsoft SharePoint Technologies is built on top of ASP.NET technologies.  In particular, MOSS 2007 is based on ASP.NET 2.0.

    This means that there are many skills that an ASP.NET developer already has that can be translated to SharePoint directly.

    • Master Pages – SharePoint uses master pages
    • Site Map – SharePoint uses the ASP.NET site map provider model and comes with many additional customized site map providers out of the box
    • Menu – SharePoint uses ASP.NET menu controls, powered by site maps
    • Page Control Lifecycle – the same key fundamental knowledge for ASP.NET is also necessary when making custom SharePoint development
    • Web.Config – like ASP.NET – many SharePoint configuration is done in the Web.Config – though SharePoint provides web UI to modify many of these options from Central Administration
    • .NET – Your .NET skills are definitely not going to go away
    • IIS – Each SharePoint web application is a “Site” in IIS, the site bindings are also identical
  19. Do you lock the SharePoint Content Database before making a backup?

    Even though you have advised staff members a migration is taking place – you can guarantee someone will try to check-in or edit documents. The best way to prevent this is to put your content database into read only mode. 

    Even though you have advised staff members a migration is taking place – you can guarantee someone will try to check-in or edit documents. The best way to prevent this is to put your content database into read only mode.

    1.    On your database server open SQL Server Management Studio

    2.    Right click on the content database associated with the site collection your migrating | Properties

    3.    Choose Options | Scroll to the bottom of the options list

    4.    For the Database Read-Only choose True

    Figure - Database Properties | Options | Database-Read Only

    5.    Now it’s safe to take a backup of your content database

     NOTE:  When some SharePoint timer services are run it may cause the site to display errors when the database is in read only mode

  20. Do you know the best ways to deploy a SharePoint solution?

    Development for a SharePoint solution is always risky and may involve bringing down the server from time to time.  So we always customize and develop SharePoint solutions on a separate development server.  But when your development is done, do you know how to deploy your changes to the staging and eventually the production server?

    The Bad method
    The naïve and bad method would be to just back up the entire content database, then copy the database backup to the destination server, and restore it there.

    1. Backup command:
      stsadm –o backup –url http://servername:port -filename c:\myfile.bak
    2. Restore command:
      stsadm –o restore –url http://servername:port –filename c:\myfile.bak -overwrite

    There are quite a few issues with this approach:

    1. At a glance – seems simple
    2. Any additional content at the destination server is wiped out – no content editing can continue while the development work is happening…
    3. Backup file can be extremely large as it includes version history and a lot of extra fat, the file can easily be over a few hundred megabytes!
    4. Deployment via backup and restore is not a Microsoft supported operation

    The Good method
    The better method is to build a feature or solution deployment package

    1. Build a VSeWSS project for package and deployment
    2. When built, this will produce a wsp file (this is a cab file) that can be deployed as features on the destination server

    A few considerations for this approach: 

    1. Site definitions, list definitions, layouts and masterpages, static content and webparts can all be deployed this way
    2. User content cannot be deployed this way. Any content will need to be exported and re-imported to move between development, staging and/or production servers.
  21. Do you make small incremental changes to your VSeWSS projects?

    • When working on packaging SharePoint artefacts into Features & Solutions, you should always make small incremental changes to your VSeWSS projects. Each time you should build & deploy to check you haven't broken anything.
    • You should regularly make labels in TFS so you can quickly compare your changes against previous working versions to identify problems.
  22. Do you know how to restore your content database to SharePoint 2010?

    This is the meat of the migration process. First we need to detach the current content database from the Web Application:

    1. On the SharePoint 2010 server, open SharePoint Central Administration | Application Management | Manage Content Databases
    2. Set the Database Status to offline | tick Remove content database
    3. Open SQL Server Management Studio and delete the database you just removed from the web application

    Now we need to attach the database backup we took of our SharePoint 2007 server:

    1. In SQL Server Management Studio right click on Databases | Restore Database…


      Figure 6 - Select “Restore Database”
    2. Follow the prompts to restore your database
    3. Take the database out of read only mode (it will be in read only mode because we backed it up in read only mode)

    Now we need to attach the content database to the web application:

    1. Open up the SharePoint 2010 Management Shell with administrative permissions.
    2. Run the following command to attach the database to the web application (replacing the red text to match your environment)

      stsadm –o addcontentdb –url http://sp2010rc/ –databaseserver <DatabaseServerName> –databasename <ContentDatabaseName>

    3. After the database has been restored you will get a status message telling you how the upgrade went, with the path to a log file. Send this file to the SharePoint developers to determine if any issues occurred during the migration
  23. Do you check for errors after the migration process?

    After the database has finished being attached to the web application you will get a log file with information about the import process.

    1. Open up this log fine and pay special attention to any lines with [ERROR].
      Note #1: The most common reason for errors is that you have forgotten to activate a feature.
      Note #2: If you have your own custom solutions, show this file to your developers to ensure it isn’t your custom solution causing the errors.
    2. Check your Application Event log after migration for errors related to your SharePoint Web Application, and fix these accordingly.

     
    figure: the event log should show 0 errors after fixing the errors

  24. Do you know to do data you need CAML?

    CAML is the XML definition for all things in SharePoint, in deployment, and in creating templates, CAML is the only format.

    In SharePoint development, you will also need to know CAML, in particular, how to write a query in CAML.

    •  Widely used in Content Query Web Parts
    • Also used in SharePoint content reports
    • In code, used by SPSiteDataQuery object

     

    <Query>
    <OrderBy>
    <FieldRef Name="Modified" Ascending="FALSE"></FieldRef>
    </OrderBy>
    <Where>
    <And>
    <Neq>
    <FieldRef Name="Status"></FieldRef>
    <Value Type="Text">Completed</Value>
    </Neq>
    <IsNull>
    <FieldRef Name="Sent"></FieldRef>
    </IsNull>
    </And>
    </Where>
    </Query>
    Figure: Example of CAML query 

    You can see - CAML is essentially the same as SQL WHERE syntax, but wrapped in an XML format.

    Problems with CAML:

    1. CAML is XML and is case sensitive – including attributes names. 
      <Query>
      <Where>
      <Or>
      <Eq>
      <FieldRef name="Status" />
      <Value Type="Text">Completed</Value>
      </Eq>
      <IsNull>
      <FieldRef Name="Status" />
      </IsNull>
      </Or>
      </Where>
      </Query>
           Figure: Example of CAML query 
    2. SharePoint is not good at telling you if you made a mistake with your CAML query.
           Figure: Debug error message
    3. Hard to debug.
      Tips: Use 3rd Party tools - U2U CAML Query Builder
           Figure: U2U CAML Query Builder
           Note: U2U CAML Builder is the best tool that we have. There are some occasional UI and interface issues, but for creating CAML and testing it against live SharePoint lists it gets the job done. And it’s FREE!

     

     

  25. Do you have a version page for your SharePoint site?

    Each time you deploy a new package to your SharePoint site, you should add a new entry in the version list.

    This will enable you to quickly find out which version of the package your SharePoint site is using, and let users know what version they are running.

     

    • A custom list for Version should be created at the root level of a SharePoint site collection, and each time a package is deployed - a new record should be added to this version list.
    • A simple blank page with a Content Query Web Part can display this versions list in a friendly manner.
    • We do not change the version numbers in the .NET Assembly because the assemblies have to be strong-name signed and deployed to the GAC.  So having a versions list is crucial in working out what version of your package is deployed on which server.
  26. Do you know to try to use the Content Query Web Part (CQWP) over the Data View Web Part (DVWP)?

    These controls are similar, but the DVWP needs heavier customization and should be avoided where possible.

    The CQWP is easier to style. The DVWP should only be used if you need one of these features:

    1. You only want to search on one column in the list, rather than all the (indexed) columns.
    2. You want to perform a search on multiple lists, but not all the lists on a web.
    3. You want to have a very specific Look and Feel that the search results use.
  27. Do you confirm there is no data lost after the migration

    After you have finished migrating the database, it is extremely important to verify that no data has been lost in the move. The quickest way to do this is to compare the SharePoint 2007 and the SharePoint 2010 server All Site Content pages and confirm that the item numbers match:

     

    Figure 7 – In the "All Site Content" pages library, ensure the ‘item’ numbers exactly match between SharePoint 2007 and SharePoint 2010

    1. Look at your report from the SharePoint 2007 server
    2. On the SharePoint 2010 server, open the site collection you just migrated to
    3. Select Site Actions | Site Settings
    4. Select All Site Content
    5. Compare item numbers with 2007

    Repeat this process for all sub-sites of the site collection you migrated.

  28. Do you use SharePoint designer well?

    We love SharePoint designer and use it everyday. 

    But there are things that it doesn't do naturally, or it does really badly.  Here are some tips on using SharePoint designer well.

    • Don't use inline CSS - this goes for any website.
    • Always put <div class="..."> wrappers around SharePoint controls. This allows us to define styles for SharePoint controls. It is possible to use CssClass like ASP.NET, but then we lose control to SharePoint regarding how that control will be rendered.  Also, some SharePoint controls will eat up your CssClass and not render anything.
    • Naming convention for control id! Don't get lazy.
    • Turn off Auto indent.  Otherwise SharePoint designer will keep modifying your file whenever it saves the HTML - this will make you very upset.

     

    Uncheck Auto indent
  29. Do you know what is broken in workflow?

    SharePoint comes with some very basic workflows out of the box.  A particular example is the content approval workflow.

    When a content approval workflow is used, it modifies the process of publishing content to be:

    1. User clicks publish (click 1)
    2. Workflow starts, and asks the user to request for approval, there’s an option to add additional messages (click 2)
    3. The workflow sends an email to the user to tell him an approval workflow has started. (email 1)
    4. The workflow also sends an email to the approver(s) (email 2)
    5. The approver receives an email, then returns to the page – they can Approve or Reject the workflow. (click 3)
    6. Either way, a new workflow screen appears, with an option to add additional messages, the approver clicks accept (click 4)
    7. The approval workflow completes and publishes the page. 
    8. It then sends an email telling the user that an approval workflow has been completed (email 3).

    What is the problem?

    The out of the box workflow is extremely generic.  It has no customizations or shortcuts.  Even if you are an approver, you cannot skip any of the steps.  The end result is that you will have to click 4 times and receive 3 emails, for approving your own finalized content.

    These kind of workflows are designed generic to fit any business’ needs – and in fact, businesses using these out of the box workflows have to adjust their staff’s workflow to match SharePoint’s ones.  Which can be counter intuitive.

    We think these SharePoint workflows need to be far more customizable.  

    SharePoint does not provide support for complex reusable workflows easily - most companies go for a 3rd party solution:

    Figure: 3rd party tool - Blackpearl
    Figure: 3rd party tool - Ninetex
  30. Do you know when to use CAML instead of object model?

    SharePoint utilizes CAML to do a lot of things - one of these is using CAML to define a query language to select elements from lists within SharePoint.

    The development experience with CAML is not good.  CAML is unforgiving when it comes to errors, but it doesn't tell you what's wrong.  Thus earning it a bad name with SharePoint developers.  People don't like CAML.

    The SharePoint object model is very comprehensive and lets you select items from lists, select lists from sites, in site-collections within web-applications.

    Naturally, using the object model is great for traversing all elements in a list.  Once you have a handle to the item, you can also easily modify that item.

    On the other hand, one of the SharePoint class SPSiteDataQuery allows a developer to use CAML to specify a query condition that SharePoint can understand to search and return matching elements from across the entire site collection.

    This is the underlying class that the Content Query Web Part relies on.

    So, you need to use object model when you want to:

    • Iterate all elements in a list
    • Modify elements in a list

    And you use CAML, whether in CQWP or in code with SPSiteDataQuery to:

    • Select, filter elements from SharePoint lists
    • Select elements from multiple lists
  31. Do you always use Site Columns instead of List Columns?

    A site column is created on a site level and visible to all lists and content types within that site (and subsites).

    You should always try to use Site Columns instead of List Columns

    • New in WSS v3 (SharePoint 2007)
    • The same column can be added to different Content Types, lists, list templates
    • Allows you to make modifications at one place and SharePoint can apply the changes for you across the different lists and content types (doesn't try to fix the content for you though)
    • More visibility of the customization we are applying to the SharePoint website
    • Make sure the site column is added to our own group description such as "SSW Columns" - this is important for filtering and exporting site column customizations for deployment.  Also great because they are now grouped in the UI.
    Figure: Create column - Bad Example
    Figure: Add from existing site columns - Good Example
    Figure: Site Columns - Good Example

     

     

    Sometimes you still may want to use a List Column.

    • You are Mary and want to create a simple list to track supplies, but you do not have site permissions to create site columns
  32. Do you know when to use SmartPart or WebPart?

    SmartPart is basically a simple but genius idea - it is a simple web part that can host a user control (ascx) inside it via the Page.LoadControl method. That way, all you have to do as a SharePoint developer is to write the ascx control, and you can do it with the Visual Studio designer to arrange the user control via drag and drop, and then when you want the web part on a SharePoint page, you load the generic SmartPart, and tell it to load the ascx that you want.

    However, there are some PRO's and CON's when you use a SmartPart:

    PRO

    1. Being able to rapidly create the control's layout and then focus on the code behind - in familiar ASP.NET user control style.

    CON

    1. Many users switch to full trust for their User Controls and disregard SharePoint security this is very easy to set up, but very bad practice.  The user control dll should be deployed to the GAC.
    2. Performance is not as good as a web part because a SmartPart is "host" by a page.
    3. Hard to deploy - this is a major problem for SSW because we use solution package to deploy web parts.  The ascx can be deployed manually to wss\VirtualDirectories\, or it can be deployed to the 12 hive via _controlTemplates/ - and then the user control referenced via ~/_layouts/controlTemplates/ but this is not an intended feature of SharePoint deployment.
    4. Hard to debug - if the ascx is written with src codebehind, then that file is compiled on demand by ASP.NET you can't debug it easily.  See xxx (link) on how to debug SharePoint.

     

    Our recommendation:

    1. Understand the difference between SmartParts and Web Parts - don't use SmartParts just because it's "easy" - there are many issues that will come back and hurt the developer.
    2. If your control does not work with SharePoint directly, or has a lot of layout elements it is OK to use SmartParts
    3. Otherwise, write your own Web Part.
  33. Does your SharePoint site have a favicon?

    All websites should be following the favicon rule.

    A Favicon is a small image file included on nearly all professional developed sites. When a browser hits your web site and a user bookmarks that site then the favicon.ico graphic will be displayed in the browser’s URL/address line upon subsequent visits to that site.

    Let's see how it's done for SharePoint:

    <head runat="server">
        <meta name="GENERATOR" content="Microsoft SharePoint">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <!--Placeholder for additional overrides-->
        <asp:ContentPlaceHolder ID="PlaceHolderAdditionalPageHead" runat="server" />
        <link rel="shortcut icon" href="~/Style Library/Images/SSW/Rules/ssw.ico" type="image/x-icon" />
    </head>

    Figure: One line of HTML lets you add your company's icon to  your web page
  34. Do you know where to add design files for deployment?

    When a designer (or a developer) adds design/style files to SharePoint - care must be taken regarding where the files are placed:

    • Some places are are not suitable because they are not good for deployment
    • Other places may have permission issues - designers can't access them
    • Some files are part of the site definition and should not be customized

    So our rules are:

    1. Never modify out of the box SharePoint files in /Style Library/ - those files are part of the site definition, if you customize them they are hard to deploy
    2. Start with a clean, minimal masterpage
    3. Create and reference your own CSS files and put them under /Style Library/CSS/<client>/
    4. You may want to further divide your CSS paths according to the areas of the site that your CSS is designed for:
      E.g. /Style Library/CSS/SSW/Clients/layout.css
    5. Designers can modify the XSL file as well!
      put them under /Style Library/XSL Style Sheets/<client>/
  35. Do you know why you need to use solution package instead of deployment manually?

    As a server product, SharePoint supports lots of configuration, but the support for packaging and deploying changes between servers remains very week.

    The experts agree that the best and preferred way to package a set of changes is to build a solution package.  A SharePoint solution package includes all the components and dependent files packed in a cab file.

    There are many reasons why you need to use solution package:

    1. All dependent files and components are in the package - allowing developers to quickly deploy development, testing, staging and production servers. 
    2. Manual steps are very long, and error prone
    3. Solution packages are easy to retract
    4. Minimize downtime in the SharePoint production server during an upgrade operation
    5. No content data loss during upgrades - SharePoint backup/restore deployment methods will block users from making changes to the production the site during the upgrade period
  36. Do you know you can't think of data the same way?

    In SQL Server you have tables to store data.  Then you have Views, Relations and Stored Procedures.

    SharePoint gives us Lists where we can store rows and columns of data, but it is not the same as a full database.

     
    • There are no joints out of SharePoint – you can do limited operations with lookup fields but they are not the same as joints in SQL Server
    • Views in SharePoint are filters, grouping and sort on a single list only.
    • Formula fields in SharePoint are only updated when the row is changed.  If you change the lookup value in the lookup list, it will not change any of the items using formula fields that are currently referencing that lookup.
    • No stored procedures in SharePoint

    Database remains the best at doing database work.  SharePoint is OK at creating quick lists and working with simple lists, but it is not a database server.

  37. What are the different images available?

    We have three types of VM images around the office.

    1. The master.vhd is for upgrading future VMs and sysprep VM's are built from the master.vhd
      The master.vhd is versioned (e.g. master_v8.vhd) to track which version it is, and to assist us in upgrading the master image.
    2. The sysprep.vhd is the one that we use to create a new SharePoint server
      When you run the sysprep.vhd it will create a new SharePoint server. Always make a copy of this to your own machine. The sysprep.vhd is versioned (e.g. sysprep_v8.vhd)
    3. You may find various other VM's created from sysprep.vhd and used for various projects or experiments
      These images are usually renamed but kept the original version number that it was created from. (e.g. sswsp_v8.vhd)
  38. Do you know how to identify customizations on SharePoint webs

    To do a successful migration, you must find all the customizations in your current environment.
    • Use command "stsadm.exe -o enumallwebs -includefeatures -includewebparts >C:\checkcustomizations.txt" to list all the features and webparts on webs.
    1. Run this command on both your current Production environment and Test migration environment to get the list of features and web parts.GetCustomFeaturesAndWebParts.jpg
    2. Use text comparision tool, such as BeyondCompare or WinDiff, to compare your Production envionment to your Test migration environment list to identify custom features and web part.
    • Go to Central Admin site to check which custom WSP package has been deployed
    1. Go to Central Admin site | System SettingsManage farm solutions, to look for deployed custom solution package.CustomSolutionPackages.jpg
    2. Compare web.config files between Production and Test environment as well to identify custom controls.
  39. Do you have a SharePoint Master

    You all know about a web master, the central point of contact if the website goes down. You should know about Schema Masters for Database Design. SharePoint should be no different.

    The SharePoint master should be your companies SharePoint expert. All major changes to the SharePoint servers should be run by the SharePoint master including: 

    • Deploying or removing solutions and features
    • Creating web applications
    • Migrations


    Figure: Do you have a SharePoint master

  40. After adding a rule on SharePoint - what steps should you take?

    To prevent spelling or grammatical errors in the text content of a rule, you should complete the following steps:

    • Check the rule in Office Word for spelling or grammatical errors
    • Run Link Auditor on that page
    • Check the report and fix the errors
    • Check in the page and repeat steps 2-3 until Link Auditor has all green ticks
    We also have a rule: Adding a rule in aspx
    Figure: SharePoint 2010 as a content management system
  41. Are your Developers Managing your Projects with TFS (with proven Agile/Scrum and ALM Strategies)?

    Team Foundation Server is the fully integrated solution to manage projects, giving developers, testers and management a single source of truth for all project needs.

    Project Managers and stakeholders will love:

    • TFS's integration with code/SQL/SharePoint which provides a dashboard with project reports, giving them greater visibility of the project status and burn down lists
    • The easily customization of the data using Excel Web Services

    Developers will love:

    • TFS 2010 for the SQL and SharePoint Server Explorer and the integration of viewing, creating and deploying
    • That they don't have to try to interpret a bug report from a tester, and then they have to reproduce it. Why? Because of Intellitrace, which allows you to double click and open to the exact line of code with the variables set.
    • Seamless source control
    • No waiting for compiling and tests to run. The integration with the build server (continuous integration) is the biggest productivity boost you can give a developer
    • SharePoint Wiki

    Testers will love:

    • The many ways of automating their manual tests via:
      • Web tests
      • Performance tests
      • And the jewel in the crown, Coded UI Tests
    • The fact they never have to spend time reproducing a bug before documenting it
    • And it gets better, they don't have to document it because testing tools recorded what they did
    • Later on, when they decide to go with Lab Manager they will never spend time setting up that special environment (say running windows 95 and IE6)

    Managing your SharePoint Projects with TFS (with proven Agile/Scrum and ALM Strategies)

  42. Do You Let Your Designers Loose on SharePoint?

    Do you let your designers loose on your development SharePoint?

    This is how we work:

    • A designer would imagine and mockup the design using a graphics tool – such as Photoshop
    • After the mockups are signed off, we let the designers work on the actual page
    • Give them designer permissions to your development site and let them loose with SharePoint designer!

    There are many reasons why we believe that designers should work directly in SharePoint, with SharePoint designer:

    • In all areas of .NET development, whether it be ASP.NET, WCF or SilverLight, designers are more and more involved with the actual project beyond mockups
    • It helps them understand the limitations of SharePoint, which helps their future design to play to its strengths
    • They are also better at CSS and DOM than a typical developer, as well as more cross-browser aware
    • They are able to make a call on how close a designer can be bent when the implementation is hard or impossible - with developers who can't make that call, they may end up spending a lot of time failing to get the last 2 pixel perfect
    • SharePoint designer is sufficiently powerful and offers the only experience currently available for building with SharePoint sites
    • SharePoint has built-in check-in and check-out, as well as version controls, publishing and approval controls - all of which are excellent for team development

    The major drawback for a designer is the complexity of a SharePoint masterpage:

    <insert picture>

    Figure: Bad - Nasty looking masterpage

    Luckily, we always start with a clean-minimal masterpage, which gives our designers full freedom to implement their vision:

    <insert picture>

    Figure: Good - clean-minimal masterpage

  43. Do you use content editor web part with care?

    The Content Editor Web Part is very easy to use in any web part zone, and gives your content editors ability to add additional text and flair to a page.
    Figure: Content Editor Web Part – available in any web part zone

    However, there is a scary hidden trap!

    Figure: Content Editor Web Part looking mostly harmless...  
    So what’s bad with the Content Editor Web Part?
    • The content in a content editor web part is not version controlled.
    • If an editor accidentally overwrites a previous copy – there’s no way to go back.
    • If an editor accidentally deletes a Content Editor Web Part – the content in it is lost.
    • Data loss is always bad – and Content Editor Web Part gives you many different ways you can easily lose data... you need tread carefully and know the risks!

    The best practice is:
    1. Do your content editing in the Content Editor Web Part, or in SharePoint Designer.
    2. Click the Source Editor button afterwards to get the raw html view.
    3. Copy and save this to a plain HTML file, and save the file in the page library (which is version controlled).
    4. In the Content Editor Web Part – link to the HTML page’s URL.
      a.If the text is very tiny – may be just a big heading, you may not want to do this.
      b.Using Content Link is also another way you can re-use the same text in different web pages and update them in one place – very good for big banners.
    Figure: Using Content Link to a file - safely stored in the document library. This gives us the best of both worlds
  44. Fix HTML - Do you implement CSS friendly?

    It is extremely important to make your site standards compliant:

    • It makes styling a lot easier.
    • It also means your site is likely to work for all browsers, even if you don’t specifically target/support them.
    • It requires accessibility for big public sites can be met easier.

    When you first run your SharePoint site – you’ll discover that it looks nice on the surface but needs a significant amount of work to fix all the bad HTML.

    Implement CSS Friendly – these are the control adapters released by Microsoft to make ASP.NET render better, non-table based controls.  You can implement them for SharePoint sites as well.

    <TABLE id=zz1_TopNavigationMenu class="..." border=0 cellSpacing=0 cellPadding=0>
    <TBODY>
        <TR>
        <TD id=zz1_TopNavigationMenun0>
            <TABLE class="..." border=0 cellSpacing=0 cellPadding=0 width="100%">
            <TBODY>
                <TR>
                    <TD style="WHITE-SPACE: nowrap">
                    <A style="..." class="..." href="...">Home</A>
                    </TD>
                </TR>
            </TBODY>
            </TABLE>
        </TD>
        ...   
        <TD id=zz1_TopNavigationMenun1>
            <TABLE class="..." border=0 cellSpacing=0 cellPadding=0 width="100%">
            <TBODY>
                <TR>
                    <TD style="WHITE-SPACE: nowrap">
                    <A style="..." class="..." href="...">Operations</A>
                    </TD>
                </TR>
            </TBODY>
            </TABLE>
        </TD>
        ...
        <TD id=zz1_TopNavigationMenun2>
            <TABLE class="..." border=0 cellSpacing=0 cellPadding=0 width="100%">
            <TBODY>
                <TR>
                    <TD style="WHITE-SPACE: nowrap">
                    <A style="..." class="..." href="...">Application Management</A>
                    </TD>
                </TR>
            </TBODY>
            </TABLE>
        </TD>
        ...
        </TR>
    </TBODY>
    </TABLE>
    Bad example - without using CSS Friendly
    <div class="CssFriendly-Menu-Horizontal" id="zz1_TopNavigationMenu">
        <ul class="CssFriendly-Menu">
            <li class="CssFriendly-Menu-WithChildren">
            <a href="..." class="CssFriendly-Menu-Link TopLevelNavItem">About Us</a>
            <div class="cbb CssFriendly-Menu-Dropdown">
                <div class="CssFriendly-Menu-Dropdown-ItemHost">
                    <ul class="first">
                        <li class="CssFriendly-Menu-Leaf">
                        <a href="..." class="CssFriendly-Menu-Link">Employees</a>
                        </li>
                    </ul>
                </div>
            </div>
            </li>
            ...
        </ul>
    </div>
    Good example - using CSS Friendly

     

  45. Is your first aim to customize a SharePoint webpart?

    You should always try to configure existing out-of-the-box SharePoint webparts before you roll your own.

    The Content Query web part in particular is very flexible – allowing contents from different lists to be presented in different ways.

    These are some of the fields in the CQWP that are often configured:

    MainXslLink, ItemXslLink:

    These two controls the main and item XSL file paths.  Set these to your new XSL file under /Style Library/XSL Style Sheets/SSW/SSWMainContent.xsl and SSWItem.xsl files

    ItemLimit

    The default number of items that are displayed on a Content Query web part is 15.  With unlimited pages.  Sometimes you want this number to be a lot higher (or -1 for no limit).

    Note: If you do make this unlimited - make sure your page is designed to grow infinitely or the layout may look strange.

    CommonViewFields

    The Content Query web part automatically selects a few of the common fields for any query.  But sometimes you want a particular field that isn't selected by default.  This is when you should use CommonViewFields.

    The syntax is "fieldname,fieldtype;"

    E.g. PublishingContent,PublishingHTML;

    Query and QueryOverride

    The Content Query web part gives the user a lot of flexibility to design the query in the UI toolpart.  However if your needs are perculiar you can use the QueryOverride to skip over defining the query and use your supplied CAML directly.

     

    [Guid("5bbdb385-5076-4a4b-85e8-691664b7f575")]
    public class WebPart1 : System.Web.UI.WebControls.WebParts.WebPart
    {
    public WebPart1() { }
    protected override void CreateChildControls()
    {
    base.CreateChildControls();
    // TODO: add custom rendering code here.
    Label label = new Label();
    label.Text = "Hello World";
    this.Controls.Add(label);
    }
    }
    Bad Example: Inherit from System.Web.UI.WebControls.WebParts.WebPart

     

     

    public class RelatedContentByQueryWebPart:CustomContentByQueryWebPart
    {
    public string RulesKeyWords //get the column name from SharePoint
    {
    get;
    set;
    }
    protected override void OverrideQuery()
    {
    StringBuilder query = new StringBuilder();
    SPListItem item = SPContext.Current.ListItem;
    string[] rulesKeyWords = {};
    if (item != null)
    {
    ......
    }
    this.QueryOverride = query.ToString(); // pass the query
    }
    }
    Good Example: Inherit from CustomContentByQueryWebPart

     

  46. Do you know the 6 ways to integrate your CRM 2011 data into SharePoint 2010?

    You have data in CRM 2011, so how do you see it in SharePoint? The data that is stored in CRM entities should be available in SharePoint so users can find and use the data in areas such as:

    - SharePoint search

    - SharePoint reporting (if you are using SQL Reporting Services in integrated mode)

    There are many ways to get to this data, let's go through them:

    You have data in CRM 2011, so how do you see it in SharePoint? The data that is stored in CRM entities should be available in SharePoint so users can find and use the data in areas such as:

    - SharePoint search

    - SharePoint reporting (if you are using SQL Reporting Services in integrated mode)

    There are many ways to get to this data, let's go through them:

    Option 1: SQL Server Filtered Views

    CRM recommends that you *don't* read from the Tables, so they provide SQL Views for this purpose.

    Summary: SharePoint BCS -> CRM database

    Pros

    Cons

    clip_image002Easiest

    clip_image002[1]Best performance

    clip_image002[2]Codeless

    clip_image004Read-only

    clip_image004[1]Not available for hosted CRM

    clip_image004[2] Security issues as you are exposing the view.

    Filtered Views in Microsoft CRM provide access to the data available that supports providing picklist name and id values (lookup tables).

    More information:

    If you only want read-only for CRM on-premises data for SharePoint users, this solution is fine. You create the External Content Type directly against the Filtered Views in the CRM database. 

    http://msdn.microsoft.com/en-us/library/gg328467.aspx

    clip_image005

    Figure: The result of “SELECT * FROM FilteredCtx_Project”. Use Office SharePoint Designer to hook this up.

    OPTION 2: Web Services

    CRM provides web services.

    Summary: SharePoint BCS -> Code calling CRM web services - > CRM database

    Pros

    Cons

    clip_image002[3]Read/Write

    clip_image004[3]Needs lots of code and test work.

    clip_image004[4]Needs to be deployed and published to the web server.

    clip_image004[5]Less performance than SQL filter views directly #1

    #1 Note: Performance could be improved by making the reads from the views and the writes through the web service

    More information: 

    1. Use BCS in VS 2010

    2. Write code that calls the CRM web services (that access the CRM data)

    3. Test

    4. Deploy

    OPTION 3: Expose OData from CRM as RSS

    The CRM 2011 OData Query Designer can be used to build queries to expose the data from CRM as RSS

    Pros

    Cons

    clip_image002[4]Easy configuration

    clip_image004[6]50 records limit. Need to page through the results.

    clip_image004[7]Possible issues with firewalls and proxies because it uses Integrated Security for authentication.

    clip_image004[8]Read-Only

    clip_image004[9]No easy way to consume


    Note: You can really only call the OData endpoint from an application that already has an authentication cookie with the CRM server.
    i.e. you can't impersonate and call it like you can the standard WCF endpoints
    So it is really only suited to calling from Silverlight and JavaScript web resources that are delivered inside CRM (because they have the cookie)

    More information:

    The first step is to expose the data:

    1. Install http://crm2011odatatool.codeplex.com

    2. Make a query

    clip_image006

    Figure: Designing a query

    3. See the data

    /SoftwareDevelopment/rulestobettercrm/PublishingImages/figure3.jpg

                    Figure: See the data - RSS source for xtc_countrySet

    The second step (and the problem) is consuming the data

    clip_image009

    Figure: BCS has no option to consume RSS data. Please Microsoft SharePoint Team, we need a new 'Data Source Type' = OData

    In summary, CRM 2011 can exposes OData, but SharePoint 2010 BCS doesn't consume OData.

    The 3 options to consume the OData/RSS data:

    · Consume the OData by SQL Server, via TSQL ???    Then use BCS to call SQL Server.
    Summary: SharePoint BCS -> DataSourceType: SQL Server -> OData- > CRM database

    You would need to be crazy to go down this route http://www.vishalseth.com/post/2009/12/22/Call-a-webservice-from-TSQL-(Stored-Procedure)-using-MSXML.aspx

    · Consume the OData by a BCS adapter + code calling web services (same story as above).
    Summary: SharePoint BCS -> code calling OData- > CRM database

    · Consume the RSS by "SharePoint RSS view web part" directly.
    Summary: SharePoint RSS view web part -> OData- > CRM database
    (not recommended as it could not be used in "SharePoint Search")

    So OData is all things horrible because it is hard to eat :-(

    OPTION 4: BizTalk

    Biztalk is built for mapping systems together, unfortunately this solution is only considered for large enterprises.

    Summary: SharePoint BCS -> BizTalk Database - > CRM database

    Pros

    Cons

    clip_image002[5]Read/Write

    clip_image002[6]The BizTalk data centre can also provide data for any system.

    clip_image002[7]Requires little code if users already have BizTalk

    clip_image004[10]BizTalk :-)

    clip_image004[11]Deployment - Needs external work to deploy BizTalk server.

    clip_image004[12]Licence Cost

    OPTION 5: SharePoint BCS Adapter (provided by the CRM Team) RECOMMENDED

    This BCS Adapter for CRM 2011 is from the CRM team (It does all of the BCS work for you by interrogating the CRM metadata service).

    Summary: SharePoint BCS -> Pre-built Adapter (.NET Assembly) -> CRM web services - > CRM database

    Pros

    Cons

    clip_image002[8]Read/Write

    clip_image002[9]Minimal coding

    clip_image002[10]Easiest to implement

    clip_image002[11]The likely way forward (Best Practice as Microsoft)

    clip_image004[13]Needs to be deployed and published to the web server.

    clip_image004[14]Less performance than SQL filter views directly

    clip_image004[15]Only recently released.

    clip_image010 
    Figure: CRM data available in SharePoint

    More information:

    Download from Microsoft

    Read "Connecting to CRM Online 2011 with SharePoint 2010 Business Connectivity Services"

    Run tool to generate the XML mapping (.BDCM)

    This solution uses a BCS Connector – a .NET Assembly responsible for mapping external data into a form usable by SharePoint. This component is loaded and hosted within SharePoint 2010, and communicates with CRM via the CRM Proxy Service.

    Option 6: OData 3rd Party solutions (doesn't exist)

    Today SharePoint 2010 exposes lists and document libraries as OData, but does not natively consume OData.

    What does this mean?

    - CRM 2011 exposes it data as OData, but cannot consume OData

    - SharePoint 2010 exposes it data as OData, but cannot consume OData

    ....and there are no 3rd party solutions to solve this...

  47. How do you deploy SharePoint?

    We use SSWPackage.exe

    The long answer:

    Deploying changes between development, staging and production servers can be a very interesting exercise:

    • It is painstakingly awkward when you realize that you have forgotten a file
    • Or forgotten to take the latest version of a particular file
    • Each iteration is manual and can be error prone
    • The result is that your developers are working late into the evening and your SharePoint servers are down for a prolonged period of time – something that may be very difficult to accept in a corporate environment

    At SSW, we saw all this was unacceptable and work to improve this process.

    Our answer to the deployment problem is a combination of tools and processes – we call it the SSWpackage.exe

    • Multiple development virtual machine environments
      • Test repeated deployment to staging before you actually deploy to the production server
    • SSW SharePoint Deployment Auditor – compares development, staging and production servers to identify missing files that needs to be deployed
      • Specify ignore lists
      • Spits out XML code that would be easy to add to your package xml
    • SSW Package Updater – updates the solution package based on the XML definitions
      • Ensure you always have the latest version of the files from development SharePoint included in your package.
    • Microsoft Visual Studio extensions for Windows SharePoint Services
      • Using the latest VSeWSS 1.3 CTP
      • Generates the package and batch files
    • SharePoint STSADM tool for deployment

    Into the future of SSWPackage.exe

    • Fully continuous integration with SharePoint
    • More SharePoint validation functions
    • Improved versioning control
    • A great GUI to bring it all together
  48. Do you use LINQ instead of CAML?

    In SharePoint development, it is always a good practice to use LINQ, instead of CAML.
    Why CAML is bad?
    • New language skills required for .NET developers
    • No IntelliSense or strongly typed objects

    Why LINQ is good?

    • No new language skills required
    • Easier to read and write
    • SPMetal is awesome for generating entity classes
    • In the backend, LINQ provider translates as much as it can to CAML first
    SPQueryquery = newSPQuery();
    query.Query= String.Format(“
    <Where>
    <And>
    <Contains><FieldRefName=‘Tags’ /><ValueType=‘Text’>{0}</Value></Contains>
    <IsNotNull><FieldRefName=‘URL’ /></IsNotNull>
    </And>
    </Where>
    <OrderBy>
    <FieldRefName=‘PostedOn’ Ascending=‘TRUE’ />
    </OrderBy>”, _filter);
    SPListItemCollectionlistItemsColl= resourceList.GetItems(query);

    Figure: Bad example – using CAML Var resourceListItems =
    From SPListItem item in resourceList.Items
    Where item.Tags.ToString().ToLower().Contains(_filter)
    && item.URL.ToString().Length> 0
    OrderBy item.PostedOn Ascending
     Figure: Good example – using LINQ
  49. How do I create my own SharePoint VM to play with?

    When you want to create a SharePoint environment, you would need to create a new Virtual Machine from the SysPrep image.

    When you want to create a SharePoint environment, you would need to create a new Virtual Machine from the SysPrep image.

    1. Make a copy of the latest version of sysprep.vhd and do not run the base one
      1. Rename sysprep.vhd so it will say what you are using it for.
        e.g. client_project_v7.vhd
      2. You will retain the version number so can we know from which sysprep.vhd it was made from
    2. In Hyper-V or Virtual PC, you create a new VM and link it to your copy of the sysprep.vhd
      1. You will need to allocate 2GB of RAM for this image
      2. You will need plenty of hard drive space (at least 25GB to 30GB)
      3. You will also need time - it is best to run this on a different machine if you plan to use your laptop at the same time when you are setting up this Virtual Machine
    3. You want to have the undo disk off initially, so that the installation commits changes directly to the VHD. Start the VM
    4. Once the VM starts up, you will be asked to login - use our SharePoint dev password for the administrator account
    5. Setup scripts will run for the administrator - this will rename the machine and install SQL Server
    6. When the process is completed, the machine will restart, and prompt you to login again as the MOSSFarm account - use our SharePoint dev password for the MOSSFarm account
    7. A second set of setup scripts will run for this account - this will install MOSS, SP1
    8. When this is all done, you will power down the VM, and commit all changes to disk
      1. You will consider setting up either snapshots or undo-disk at this point.
  50. Do you do a pre-migration check on the SharePoint 2007 Server

    It is a good idea to run a pre-migration check on the SharePoint 2007 before starting the migration process.

    1. Check you have followed Do you add stsadm to the environmental variables?
    2. Open up cmd with Administrator privileges
    3. Run the following command: stsadm –o preupgradecheck

       
      Figure 3 - Check the pre-migration report. The only thing that is allowed to fail is “FeatureInfo”. This is because a custom feature won’t migrate and developers need to create a build targeted for SharePoint 2010
    4. Save the HTML file that was generated and email it to your companies SharePoint Master. (Don’t print it as its very large)
    5. Have the SharePoint Master sign off on the pre-migration check and inform you if there are any site collections or content sources that are no longer needed and can be ignored for migration

     

  51. Do you always set InfoPath compatibility mode to design for both Rich and Web client forms?

    DRAFT: InfoPath Rule number 1

    Do you always set compatibility mode to design Rich and Web client forms?

    This is the number one, and most important rule in working with InfoPath.

    Always go for the lowest common denominator.  It sure beats realizing half way later that your form can't be hosted on SharePoint InfoPath Forms Services!

    <insert picture from InfoPath>
  52. ASP.NET vs SharePoint development - do you know deployment is different?

    In ASP.NET deployment is a simple xcopy. Or you can right click the Web Site project and  "Publish Web Site" in Visual Studio.

    Fugure: Publish Web Site in Visual Studio

     

    In SharePoint the way to deploy a set of changes is via a solution package.

    SharePoint provides additional layer and infrastructure on top of ASP.NET  - part of this layer is the support for administrators (who may not be developers) to quickly add, remove, activate and deactivate features across a SharePoint site farm.

    These are awesome features and something that basic ASP.NET does not have, but it does add additional development overhead to build the solution packaging.

    1. You need to create such a package via VSeWSS (or a similar tool such as WSP Builder)
    2. Add entries for all the files you want to include in the package
    3. Update and get the latest version of the files from development SharePoint or TFS
    4. Compile the package into a WSP file (which is a cab file)
    5. Test the package on a staging server.
    6. Deploy it on a production server.
  53. Do you confirm there is no checked out data?

    Pages in SharePoint are easily checked out, and the changes not checked-in will not be migrated when you do migration for SharePoint data.

    In SSW, we have two ways to check the "checked out files" regularly:

    • A. Manage Content and Structure Report (No Code)
    • B. Custom application report (Includes some coding work)
    A. Manage Content and Structure Report (No Code)
    1. Create CAML query in site content and structure
    Go to "Site Settings | Manage Content and Structure | Content and Structure Reports", click "New":
    ContentAndStructureReportsNew.png 
    Figure: Create a new report
    Fill the "CAML Query":
    <Where><IsNotNull><FieldRef Name="CheckoutUser" LookupId="TRUE"/></IsNotNull></Where>
     
    Fill the other fields like below:
    NewReportForm.png 
    Figure: Fill in form

    2. Run Checked Out report
     
    Run the checkout report from "Site Settings | Manage Content and Structure | View: Checked out documents":
    CheckedOutDocuments.png
    Figure: Checked Out Documents report link make sure there are no files checked out, otherwise, go step 3.

    3. Go chase after the users.

    B. Custom application report (Includes some coding work)
    In SSW, to make the chase work easier, we have a custom page to show the "Checked out files" and send the notification email to naughty people:
    CheckedOutFilesApplicationReport.png 
    Figure: "Checked out Files" custom application report
     
    Notification email sample:
    Hi Daragh,
     
    You have some pages checked out in SharePoint.
    1. Revise our SSW rule on Frequent SharePoint Check-ins.
    2. If you are no longer editing these files, check them in!
     
    You currently have the following pages checked out:

    Remember, you can check which files you have checked out at any time by going to http://<siteurl>/_layouts/SSWReports/CheckedOutReport.aspx

    William

     

  54. Have you considered SharePoint 2010 for Internet Sites license?

    In MOSS 2007, to run a public internet site on SharePoint included many hidden costs that soon accumulate to a big number that puts it out of the reach of most small and medium companies.

    As a rough calculation - it costs over $160k to run 3 MOSS servers with internet license for internet sites.  As much as people loved the features of MOSS for publishing sites - this was a major drawback.
    Microsoft recognised this problem, and in SharePoint 2010 line up, they added an additional "SharePoint 2010 for Internet Sites" licenses for standard and enterpise features. 

    Microsoft has yet to release pricings for SharePoint 2010 - but we can expect the internet sites for standard SharePoint Server to be highly comparable.
  55. How to publish a report based on a list?

    ​When you want a Grid with filters, group by, totals and sorting, how do you do this (if all the data is in a list) ?

    There are 6 options:

    if you need to use the object model (like PublishedBy.aspx) to interate through records - use Option 1,3,5 , and we prefer option 5.

    if you need to bind a simple list  - use Option 4 (best designer, scheduling included, parameters are easy... we know that iFrame is not great).

     

     

  56. Indicate the magnitude of a page edit

    Add an extra column to the “Version History” page to show how big a change was made in each version (in number of lines modified or MB changed or something).

    In this case the editor (Ulysses) clicked on edit just to see what it looked like from an Editor’s viewpoint, but there is no indication that there was no significant change.

    The edits that were not significant should show their records as dimmed.

    Figure: Version History

    P.S. the URL should be nicer than this:
    http://sharepoint.ssw.com.au/Standards/Communication/RulesToBetterEmail/_layouts/Versions.aspx?list=1badd854%2D7165%2D46cb%2D920e%2D44e2355cd6e7&ID=2&FileName=%2FStandards%2FCommunication%2FRulesToBetterEmail%2FPages%2FDefault%2Easpx&Source=%2FStandards%2FCommunication%2FRulesToBetterEmail%2FPages%2Fdefault%2Easpx

  57. Do you use field and list item validation (in 2010)

        class CreateShoppingListHandler : SPItemEventReceiver
        {
            public override void ItemAdding(SPItemEventProperties properties)
            {
                float price = 0;
                float cost = 0;
                
                if(float.TryParse(properties.ListItem.Fields["Price"].ToString(), out price) && float.TryParse(properties.ListItem.Fields["Cost"].ToString(), out cost))
                {
                    if(price < cost)
                    {
                        properties.ErrorMessage = "The cost must not be less than the price";
                        properties.Cancel = true;
                    }
                }            
            }
        }
    Bad example: using custom code – creating a custom event receiver on the item (the item adding event or item updating event)

    Good example: using no code – just using the field validation on a list
    A demo of this from Andrew Connell on
    http://channel9.msdn.com/learn/courses/SharePoint2010Developer/ListsAndSchemas/FieldandListItemValidation/
  58. Do you know how to work with document versions?

    This is how you should work with Document Versions:
    1. Make sure your document library is configured to use versioning.
      TIP: You can configure this in Settings | Versioning Settings​
    2. Make sure you are showing the version column in your document view.
      Add a version column

      TIP: You can add the column by selecting Modify View

      ​​
    3. Whenever you edit the document and check it in, SharePoint will automatically increase the version number.
    4. If you need to send this document to a client then it is important to:

      1. Save the file locally by selecting Send To | Download a Copy
        Save a file locally
      2. Add the version to the end of the filename e.g. Specifications_v2.0.docx
      3. Then email it to the client.
      4. We do this so that we can track what version of the document was sent to the client.
      5. ​TIP: If you are not working with SharePoint then we recommend you follow the rule Do you include version numbers in your file names?

  59. How do I update and create a new version of the Sysprep VM ?

    When MS releases a new service pack, or new Windows update, we install these to the master image and create a new version of the Sysprep image for future VMs.
    1.  Update SQL Server service packs
    2. Update Windows Server 2003 service packs
    3. Update Windows
    4. Update VS.NET service packs
    5. Update SharePoint service packs
    6. Update MS Office SharePoint Designer service packs

    To create a new VM:

    1. Make a copy of the master.vhd, rename it to the next version
    2. Create a VM using this new vhd
    3. Copy additional setup files to D:\install\
    4. Modify the scripts in D:\scripts\
    5. When finished, power down the VM. Make a copy of this and rename it to sysprep-vNext.vhd
    6. Create a new VM using this new vhd
    7. Start it up, and then run the sysprep command in D:\sysprep\
    8. This will generalize the computer's settings and shut it down
    9. Don't start up the VM again - or it'll run the start up scripts
    10. Zz old copies of the master.vhd and sysprep.vhd
  60. Do you confirm your list of installed SharePoint 2007 Solutions

    When you move to SharePoint 2010, nothing is to unexpectedly disappear. So prior to the migration, you need to find out which solutions you currently have installed and decide if you will be installing them on the new server.
    1. On the SharePoint 2007 Server, open Central Administration and go to Operations | Solution Management
    2. Copy the Solution Name, Status and Deployed To into the following table. This will ensure you deploy all the solutions you had on your old server to the SharePoint 2010 server
    3. Cross out any solutions that you will not be migrating
    4. Get the SharePoint master to sign off on the solution list
    Figure: Have your SharePoint Master confirm if all these solutions are to be migrated

     

    Download

        Download the “Installed Solutions Checklist”
  61. Do you know the best SharePoint 2010 development environment?

    Developing in ASP.NET is easy, you just press F5, Visual Studio spins up instance of the Cassini web server, and you can see your work execute. Developing in SharePoint is much harder as you need access to a local SharePoint server to see your work run.

    In SharePoint 2007 there are three options, in SharePoint 2010 they have added one more.

    Figure: Setting up the development environment in SharePoint can give you a headache
    Your development choices in SharePoint 2007 are:
    • Remote to a shared SharePoint development server
      Tip: This is best for people who do *not* need to have their own SharePoint server, such as designers, testers or content editors.
      Problem #1: By default you only get 2 concurrent accounts
      Problem #2: IISRESET clobbers other users.
    • Run your own local virtual machine (VM)
      Tip #1: Use an external drive to make it faster
      Tip #2: Use SSD to go even faster :)
    • Use ‘Boot’ to VHD (Recommended - most trouble but best performance)
      Note: Only if you have Windows 7 as the host
      See: Less Virtual, More Machine - Windows 7 and the magic of Boot to VHD

    One of the biggest problem is that SharePoint 2007 can only be installed on Windows Server and most developer machines do not run Windows Server as the host OS. Tweaks to install SharePoint to Vista were available, but considered risky – since your development environment does not fully reflect the production server.

    In SharePoint 2010 – the scenery has changed a little. These are all your options now:
    • Remote to a shared SharePoint development server
      Tip: This is best for people who do *not* need to have their own SharePoint server, such as designers, testers or content editors.
      Problem #1: By default you only get 2 concurrent accounts
      Problem #2: IISRESET clobbers other users.
    • Run your own local virtual machine (Not recommended – because SharePoint 2010 is 64-bit only)
      Tip #1: Use an external drive to make it faster
      Tip #2: Use SSD to go even faster :)
      Tip #3: The 64-bit requirement means, you can’t use Virtual PC, and so you have to use either Hyper-V (which requires a Windows Server host), or VMWare
      Tip #4: The 64-bit requirement means, your host must be x64 to run the virtual machines in x64
    • Use ‘Boot’ to VHD (Recommended)
      Note: Only if you have Windows 7 as the host
      See: Less Virtual, More Machine - Windows 7 and the magic of Boot to VHD
    • Install SharePoint 2010 on your Windows 7 PC (Not Recommended)
      You are not fully representing the production server
    Are there any shortcuts for Silverlight developers (for SharePoint consumption)?
    • Yes, you can easily deploy a xap file to a document library. However, if you need to debug it you will need the SharePoint 2010 object model.
      Tip: You could minimise your exposure to the object model by using a Repository pattern, which would allow you to debug and test your application without SharePoint, but ultimately you will need to debug and test in SharePoint.
    Figure: The Ultimate solution for SharePoint development environments is to have another machine under your desk. The Ultimate Solution
    • Get yourself a second machine (same as remote)
    • But don’t share it with anyone else!
  62. Do you know the best way to take SharePoint data offline?

    In SharePoint 2010, there are quite a few tools that we can use to take SharePoint data offline. Let’s look at our options:
    • use Outlook to synchronize document libraries, calendar and contacts offline.
    • use Excel to take read-only copies of list data offline.
    •  use Access to take list data offline – Access also lets you edit offline and synchronize back.
    •  use SharePoint Workspace (this was Groove) to take entire Site offline, unfortunately this doesn’t work for calendars.
    We think the best way is to use Workspace instead of Outlook:
    1. SharePoint Workspace synchronize an entire site
      a. So when lists are renamed it knows about it.
      b. It also knows about new lists that are added to a SharePoint site Figure: SharePoint Workspace synchronizing an entire site
    2. Outlook can be quite busy when synchronizing to Exchange server; it is good to not burden it with more work.
    While SharePoint Workspace is quite good, we don’t like to store lists in it:
    1. Access has better filtering, sorting options when offline
  63. Do you create BCS connections to all your line of business (LOB) applications?

    In SharePoint 2007, we have Business Data Catalog to connect SharePoint to other line of business applications.
    When you connect your other systems to SharePoint you can then have one central place to see your data:
    1. Microsoft CRM connected to SharePoint allows you to search for CRM contacts from SharePoint
    2. TFS connected to SharePoint lets you see the project documents and reports via SharePoint
    3. Your roster system connected to SharePoint allows you to see those calendars in SharePoint
    In SharePoint 2010 – the Business Data Catalog is upgraded to the new Business Data Connectivity Service (BCS).
    1. It is a lot easier to plug-in
    2. Supports not just READ operations, but delete, update and create operations as well.
  64. Do you have uptime checks for your public sharepoint site?

    Any configuration settings, that you rely upon, must have a check so you get an email as soon as the problem arises. Eg.
    An anonymous access check - A web publishing site needs a check to make sure anonymous access is configured correctly.

    Figure: Enable anonymous access for publishing site
    Figure: monitors for anonymous access - If the monitor is down, there will be an email sending out to our network admins
  65. Do you know how to get the SharePoint document version in Word?

    We are always disappointed when adding version information to a Word document. When you use the Work version you get a number that indicates the number of times the document has been saved and not a proper version number.

    It is possible to get the number into Word for the version of the document on the SharePoint document library.

    Follow the guide here: http://www.bryansgeekspeak.com/2009/03/moss-2007-show-sharepoint-version.html

    Note: This also works in SharePoint 2010 and Office 2010.

    Figure: Good example, you see the formatted SharePoint version number
    Bad Example
    Good Example
  66. Do you turn off auto activation on farm and web application scope features?

    Each SharePoint packages contains features that can be targetted at various scopes. 

    You need to pay special attention when you are targetting the Web Application scope.

    The feature XML looks like this.

    <Feature Id="{GUID}" Title="WebApplicationConfiguration" Scope="WebApplication" Version="1.0.0.0" Hidden="FALSE" DefaultResourceFile="core" xmlns="http://schemas.microsoft.com/sharepoint/" >

      <ElementManifests />

    </Feature>  

     

     

     But there is a problem...

    The problem with this web application feature is that it will activate by default on All new Web Applications created on that farm, regardless of what the web application or root site template is.

    The best practice is to make sure you use the additional attribute ActivateOnDefault and set it to False.  Then SharePoint administrators can choose to activate the feature after a new web application is created.
     <Feature Id="{GUID}" Title="WebApplicationConfiguration" Scope="WebApplication" Version="1.0.0.0" Hidden="FALSE" DefaultResourceFile="core" xmlns="http://schemas.microsoft.com/sharepoint/
    ActivateOnDefault="False">

      <ElementManifests />

    </Feature>



  67. Do you know when to use BCS?

    If you want an easy way to access data in remote or legacy systems, provide one or more of the CRUD operations to the end users and search the data within the SharePoint search framework, then you should consider BCS. You can also use MS Office applications to access the data from SharePoint.

    However, BCS doesn't do everything.  It does not provide support for WorkFlow or EventReceivers on the list in SharePoint. 

    BCS is good for synchronising the data at SharePoint with one other system.  It is not suitable for publishing the data to multiple systems (i.e. syndication). If you need to implement syndication, use a standard SharePoint List and attach either a Workflow or an EventReceiver to handle sending updates to the end systems instead.




    Use BCS with multiple systems(not working)



    Use BCS with one system at time

  68. Do you avoid using BCS when you need Workflow?

    If you are planning to use Workflow, use Workflow with SharePoint List instead of BCS. Because Workflow cannot be associated directly with external lists. The reason is data is not stored in SharePoint, so the Workflow cannot be notified when items change.



    BCS doesn't have WorkFlow support



    Use WorkFlow with SharePoint List
  69. What does a SharePoint image need?

    As a minumum, the SharePoint image needs:


    1. Windows Server 2003 or 2008
    2. SQL Server 2005 sp1
    3. WSS 3.0 sp1
    4. MOSS 2007 sp1
    5. MS Office SharePoint Designer sp1
    6. Visual Studio .NET 2005 or 2008
  70. Do you document the details of your SharePoint 2007 web application

    When you move to SharePoint 2010, you will need to know the settings you had on your 2007 server.
    Therefore document all the settings from the SharePoint 2007 server, that you will need to re-create on the SharePoint 2010 server.

    Fill in the following table. You will use this later when creating the new web application in SharePoint 2010.

    SharePoint 2010 Web Application Option

    Where To Find This In SharePoint 2007

    Answer

    Authentication Provider

    Use classic unless you know you need claims based authentication 
    Note: this is a new feature in SharePoint 2010.

     

    New IIS Web Site Name

    Application Management | Web application list | Name Field

     

    Port

    Application Management | Web application list | URL Field
    Port number will be listed on end of URL (if nothing its port 80)

     

    Host Header

    Application Management | Web application list | URL Field if a DNS name is used (not just the NetBIOS name). 
    If a DNS name is NOT used, leave this blank.

     

    Authentication Provider

    Application Management | Authentication Providers | (Click On the default zone if applicable) | IIS Authentication Settings field.

     

    Allow Anonymous

    Application Management | Authentication Providers | (Click On the default zone if applicable) | Anonymous Access field.

     

    Use Secure Sockets Layer

    Check whether the SharePoint site URL like “https://***”

     

    Public URL

    Automatically updated from Host Header

     

    Application pool name

    Leave defaults

     

    Security account for this application pool

    Leave defaults

     

    Database Name

    Zz the database name so you know this will be replaced (read zzOldFiles)

     

     


  71. Do you always use Data Connection Library for InfoPath forms?

    MOSS 2007 allows you to create a Data Connection Library to hold all the connection information that Forms and Excel services can utilize.

    You should always use a Data Connection Library.

    Data Connection Library provides a central location for defining all the connections to various data sources within your company.

    • It allows you to change the data source definition in one place, without having to worry about changing the same definition in 50 forms and excel spreadsheets.
    • A centralized data connection library also helps your users to locate data easily.
    • Your users don't want to know the intrincate details on how to get a particular data - they just want the data and have the form working!  So if you as the administrator provides it for them, they will love you, they will use it, and you will have a easier time managing your SharePoint site!
    Everyone wins!
  72. Do you turn off auto update on your SharePoint servers?


    A recent Security Hotfix has broken SharePoint WSS3 stand-alone installations.  This has prompted Microsoft SharePoint team to quickly release information regarding how to fix the issue.

    http://blogs.msdn.com/b/sharepoint/archive/2010/06/22/installing-kb938444.aspx

    This again reminds us that it is always not a good idea to have Windows Update automatically updating your servers.  There are a few reasons.

     

    1. The previously mentioned problem - where the hotfix could bring down a production environment. 
    2. In fact, even in a development environment this could be hours of lost work as the development team struggles to understand why only some of the developers' SharePoint magically and mysteriously broke overnight.
    3. Windows Update could restart your server, or put your server in a state where it requires restarting - preventing any urgent MSI installs without bringing down the server.

    Windows Update remains the best thing for end-users to protect their systems.  But in a server, especially a production server environment - Windows Update patches are just like any new versions of the software that's built internally.  It should be tested and then deployed in a controlled manner.

    So recommendations:

    1. Windows Updates may be critical and should be kept relatively up to date.
    2. Have a plan where your awesome Network Admins schedule time to keep the servers up to date - including testing that the servers still perform its functions.
    3. Turn off Automatic Windows Update on Windows Servers
  73. Do you know how to format dates to include the weekday?


    Figure: Bad example - using the default Date Format


    Figure: Good example - using the Date Format with 'ddd'

    How do you do this ?
    By default, the date type column only have two format options:

          Figure: Date Format #1 Figure: Date Format #2
    To add the week day(eg.Wed) you need to:
    1. Select List Settings | Columns |Create column | Calculated (calculation based on other columns)
    2. See the columns of this list in the "Insert Column", add the column you want to change format, and custom the code in "Formula" like below:   
      Figure: Calculated column with Formula code
    3.  Change the views of the list to use the new Calculated column (WeekDate) instead of the original date column (Date): Figure: Replace the old Date column (Date) with new Calculated column (WeekDate It should not be this hard - see suggestion to the SharePoint team to make date formatting easier.
  74. Do you know what collaboration means?

    Among other things it means never sending attachments in an email. Once an attachment is included in an email there are multiple copies of that attachment. If people change the contents of the attachment there is confusion about who holds the "master version" of that file.
    SharePoint changes this by allowing you to easily email a link to a SharePoint file. This means all recipients review and edit the single "master version" of the file.

    Figure: Good example: Email a link, not a file
  75. Do you remove ‘My Site’ and ‘My Profile’ if you are not using them?

    My Site and My Profile are great but if you are not using them, it makes sense to remove them:
    Figure: Links need to be hidden
    You can follow below steps to hide “My Site” and “My Profile”,
    There are a few options, based on what you need to do:

    1. Delete the association (not recommended)

      a. Go to Central Admin | Application Management | Service Applications | Configure service application associations
      Choose “default” link:
      Figure: Choose “default” link

      b.Uncheck the “User Profile Service Application”  in the opened page, then click “OK”:
      Figure: uncheck the association for user profile service

    2. Customize permissions for only some people to have access to create personal site

      You can remove it for most people - but leave it for only some users.

      a.    Go to Central Admin | Application Management | Service Applications | Manage service applications,
      Click the link of “User Profile Service Application”, navigate to its manage page:

      Figure: “User Profile Service Application” manage page

      b.    Click People | Manage User Permissions, you can customize the user profile permission for specific users:
      Figure: Better - customize User profile permission

    3. Delete the service (recommended if you don't need the service at all in your farm)

      Note: You can always create it later if you need it in the future.

      Go to Central Admin | Application Management | Service Applications | Manage service applications,

      Select “User Profile Service Application”, then click the “Delete” button on the ribbon:
      Figure: Best - delete user profile service

    Note: Later on if you want to get My Site working read these 2 links… unless Microsoft creates a services that fixes User Profile Synchronization service…. thanks to Mark Rhodes for these tips…
    http://www.harbar.net/articles/sp2010ups2.aspx and http://www.harbar.net/articles/sp2010ups.aspx


  76. Do you know that you can't use 2010 Managed Metadata with Office 2007 out of the box?

    SharePoint 2010 and Office 2010 ships with a fantastic document management feature "Managed Metadata Service". This new service provides first class support for enterprise taxonomy within a standard SharePoint 2010 environment.

    Unfortunately, Office 2007 and Office 2003 can't work with managed metadata fields out of the box.
      Office 2010:
    1. Works fine
      Office 2007:
    1. Document information can't display managed metadata
    2. You can still save documents to SharePoint
    3. But you can't check-in (if metadata fields are required)
    4. User needs to perform a web check-in
      Office 2003:
    1. Can't create new or Open documents with managed metadata
    2. Install Office 2007 document support upgrade, this bring the experience a bit better similar to Office 2007.
    See more: 

    https://www.nothingbutsharepoint.com/sites/devwiki/articles/Pages/Managed-Metadata-Columns-in-Office-2007.aspx

    Best Solution:

    Use a 3rd party solution - the best one being OnePlaceMail which provides a UI for managed metadata via the "Save to SharePoint". Works with all three versions of Office so users get a consistent UI.

    Figure: The optional save dialog that pops up when saving document to SharePoint - allowing use of Managed Metadata from Office 2003, 2007 and File Explorer
  77. Do you know this quick fix for SharePoint JavaScript errors that prevents you from switching page layout?

    Follow the step to fix SharePoint JavaScript errors:
    1. Your content editor is trying to change page layout via the Ribbon in SharePoint 2010
       Figure: Click Page Layout in the Ribbon
    2. But they get a JavaScript error

      Webpage error details

      User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)
      Timestamp: Wed, 22 Dec 2010 01:33:17 UTC

      Message: Object required
      Line: 2
      Char: 6422
      Code: 0
      URI:http://intranet.ssw.com.au/_layouts/cui.js?rev=wvoVpqlQb30nGo4DjDk8Kg%3D%3D

    This error is likely caused by SharePoint trying to render available page layouts for the page to switch to, but there is an error.

    A very quick fix that can be applied by a site owner is:
    1. Site Settings | Look and Feel | Page layouts and site templates 
    2. Restrict the valid number of page layouts that can be used, instead of allowing "Pages in this site can use any layout"Figure: Restrict valid page layouts
    3. This fixes the Ribbon menu
      Figure: Ribbon menu fixed!
    4. Tell your sys admin that there are broken packages in SharePoint and must be fixed ASAP
  78. Do you know how to fix people's display name in SharePoint ?

    When SharePoint encounters a new person, it takes people's display name and account name from Active Directory, but sometimes
     Figure: Mixed up names - some are good Display Name, some are essentially just the Account Name (More here)
      The easiest way to fix this requires someone with central administration access:
    1. Go to: SharePoint Central Administration | Application Management | Service Applications | Manage Service applications
    2. Go to User Profile Service Application
    3. Go to Manage User Profiles
    4. Find the user profile that you want to update
    5. Fix the Name field (Display name)
       
    6. Save

    Better way
    The better way is to set up User Profile Synchronization and have SharePoint communicate with Active Directory on a schedule and keep user's profile information up to date. Unfortunately, it can be tricky to set this up in SharePoint 2010.

    Technical
    When a user is entered (or using) a SharePoint site, the site will first check with Central Admin (the farm) to enquire about this user's profile details. The farm grabs the account name and display name from Active Directory, but does not keep this synchronized.

    Unless configured otherwise, end users in SharePoint do not have the ability to modify their own display name. And the best place to update this is to either:

    1. Modify the farm user information list cache (via steps above), or
    2. Set up User Profile Synchronization
  79. Do you stop editing, when you see “Read Only”?

    When editing a .doc file in a SharePoint document library, you need to always “check Out” when you see “Read Only”. You need to “Check In” the document after editing to TFS.


    Check-Out when you see ReadOnly

    Figure: Warning - If you see “Read-Only” in the title bar, then you need to “Check Out”


    Click Check-Out to edit

    Figure: Click “Check Out” to edit the document in TFS

    Save before closing
    Figure: When you click “yes”, expect a 2nd dialog (for SharePoint controlled docs)

    Check - in after saving the changes
    Figure: Good – the dialog you should always get on saving

  80. How does the sysprep process work, what does the scripts do? Why is this process so complicated ?

    1. SharePoint server can't be renamed after SharePoint is installed
    2. Multiple VM's with the same name can't be powered up in the same network
    3. So the master.vhd contains:
      1. Windows 2003 server SP2
      2. Visual Studio .NET 2005
      3. Microsoft Office SharePoint Designer
    4. When sysprep is ran on the master.vhd, it generalises Windows 2003 server (generate new machine guide, rename computer, etc), the scripts that run also puts "administrator" into the registry so that'd be the name of the next login prompt. A vhd that is in this state is the "sysprep'ed" vhd
    5. When it restarts and the user logs in with administrator, it then runs the script to install
      1. SQL Server 2005
      2. Puts MossFarm account into registry
    6. After restart - login with MossFarm account and run the scripts to install
      1. SharePoint 2007 sp1
    7. Runs Moss\Post_Build.cmd
  81. Export Method - Do you know how to export the solution if you don’t have the original installer or source code? (optional)

    (Not recommended)
    In unusual cases where you don’t have source code (for your own customizations) or the setup files (from 3rd party vendor) of the SharePoint solutions that have been deployed in the SharePoint 2007 server, there is a way to export the solution files.

    1. Download Solution Exporter from Mark Wagner's Cogitation Blog and run it on the SharePoint 2007 server. This allows you to export the installed solutions from the source SharePoint server.
    2. Export all of the solutions out of the SharePoint farm.
    3. Copy the C:\SharePointCustomizations folder to the destination SharePoint 2010 server.

     

  82. Do you create a minimal master page?

    To create a master page or reuse an existing master page is a time-consuming process. Because you have to determine what the Office SharePoint Server 2007 page model requires — necessary content placeholders and controls to work with the page layouts.

    Another problem of Default.master is that it contains many tables that are difficult to style.
    <%@Master language="C#"%>
    ...
    <HEAD runat="server">
    ...
    <Title ID=onetidTitle>
    <asp:ContentPlaceHolder id=PlaceHolderPageTitle runat="server"/>
    </Title>
    ...
    </HEAD>
    <BODY scroll="yes” ... >
    <form runat="server" onsubmit="return _spFormOnSubmitWrapper();">
    <WebPartPages:SPWebPartManager id="m" runat="Server"/>
    <table class="ms-main" CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="100%" HEIGHT="100%">
    <tr>
    <td>
    <asp:ContentPlaceHolder id="PlaceHolderGlobalNavigation" runat="server">
    <table CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="100%">
    ...
    </table>
    </asp:ContentPlaceHolder>
    </td>
    </tr>
    <tr>
    ...
    </tr>
    <tr>
    <td id="onetIdTopNavBarContainer" WIDTH=100% class="ms-bannerContainer">
    <asp:ContentPlaceHolder id="PlaceHolderTopNavBar" runat="server">
    ...
    </asp:ContentPlaceHolder>
    </td>
    </tr>
    <tr height="100%">
    <td>
    <table width="100%" height="100%" cellspacing="0" cellpadding="0">
    ...
    </table>
    </td>
    </tr>
    </table>
    <asp:ContentPlaceHolder id="PlaceHolderFormDigest" runat="server">
    ...
    </asp:ContentPlaceHolder>
    ...
    </form>
    <asp:ContentPlaceHolder id="PlaceHolderUtilityContent" runat="server"/>
    <asp:ContentPlaceHolder id="PlaceHolderBodyAreaClass" runat="server"/>
    <asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat="server"/>
    </BODY>
    </HTML>
    Bad example - using default master page

    So we recommend using the minimal master page which includes the necessary placeholders.
    To create a minimal master page

    1. Open SharePoint Designer.
    2. On the File menu, click New, point to SharePoint Content, and then click the Page tab.
    3. Double-click Master Page to create a new master page.
    4. Click Design to show the master page in design view. You should see header and left margin areas and several content placeholders in the master page.
    5. Click Code to show the master page in code view.
    6. Copy the code from How to: Create a Minimal Master Page into the master page.
      <%@ Master language="C#" %>
      ...
      <html>
          <WebPartPages:SPWebPartManager runat="server"/>
          <SharePoint:RobotsMetaTag runat="server"/>
          <head runat="server">
              <asp:ContentPlaceHolder runat="server" id="head">
                  <title>
                      <asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server" />
                  </title>
              </asp:ContentPlaceHolder>
              <Sharepoint:CssLink runat="server"/>
              <asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server" />
          </head>
          <body onload="javascript:_spBodyOnLoadWrapper();">
              <form runat="server" onsubmit="return _spFormOnSubmitWrapper();">
                  <wssuc:Welcome id="explitLogout" runat="server"/>
                  <PublishingSiteAction:SiteActionMenu runat="server"/>
                  <PublishingWebControls:AuthoringContainer id="authoringcontrols" runat="server">
                      <PublishingConsole:Console runat="server" />
                  </PublishingWebControls:AuthoringContainer>
                  <asp:ContentPlaceHolder id="PlaceHolderMain" runat="server" />
                  <asp:Panel visible="false" runat="server">
                      <asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server"/>
                      ...
                  </asp:Panel>
              </form>
          </body>
      </html>
          Good example - using minimal master page
    7. On the File menu, click Save As, provide a unique file name with the .master extension, and then save the file to the master page gallery (/_catalogs/masterpage) in your site collection.
  83. Do you know the best way to implement administrators' login

    When administrators need different credentials to login to a SharePoint site, there are different ways to implement it.

    ​1. Obvious "Login" link for administrators:

    LoginLink.png

    Bad example: Obvious 'login' link for administrators

    2. Use little dot for a hidden link:

    HiddenDotLink.png
    Bad example: little dot for a hidden link

    3. Use /admin/ to let administrators to login (WordPress nearly got it right with /wp-admin/):

    AdminURL.png
    Good example: Use /admin/ URL for administrators

  84. Import Method - Do you know how to import a solution if you don’t have the original installer? (optional)

    You should have at this point, either:

    1. Installer packages from 3rd Party Vendors for installing their custom solution or,
    2. WSP packages from 3rd party, or built from your own source code, or extracted using the Export Method (not recommended)

    You can add the WSP package solutions to the new server by:
    1. Open up cmd with Administrator privileges
    2. Enter your C:\SharePointCustomizations folder
      cd C:\SharePointCustomizations
    3. Use stsadm to import the solution to your new server
      Stsadm –o AddSolution –filename NameOfSolution.wsp
    4. Make sure there are no errors when the command runs
  85. Do you know common web configuration stuff you will need?

     In SharePoint, web configuration includes:
    1. ASP.NET 3.5 library references – this is necessary for all the ASP.NET AJAX calls
    2. Add system.web/pages/controls – to add additional tag prefix from System.Web.Extensions
    3. Add HttpModule (for example – to clean up extra JavaScript from SharePoint)
    4. SafeControl tags for all custom dlls – in general these can be added via your solution package as well

    You should always use a SPConfigModification class to modify your web.config – never tell your user or administrator to make changes manually!  This also allows them to switch off a feature from SharePoint knowing that the changes had been reverted.

    For developers – you must test your SPConfigModification carefully, mismatched XPath will cause problems in your web.config and create duplicate entries!
  86. Do you know how to create a new web application and site collection in SharePoint 2010?

    We are now ready to make a new web application and site collection which we will need to match closely to the original SharePoint 2007 server. In the SharePoint 2010 server:

    1. Open SharePoint Central Administration | Manage web applications
    2. Click on New
    3. Enter in the details for the web application using the document from the rule Do you document the details of your SharePoint 2007 web application?
    4. Go back to SharePoint Central Administration | Create site collections
    5. Fill out the form to create a new site collection – the only option that is important here is to create a site collection that matches the site collection you will be migration. Eg: If the site collection you are migrating is a Team Site, make a site collection that is a Team Site.

    Note: The rest do not matter as they will be replaced when you restore the database from SharePoint 2007.

  87. Do you know how to create a "Customer Portal" (in SharePoint)?

    ​You should do anything that helps a project succeed. The best thing is to enable great collaboration, by giving your customer an awesome 'Customer Portal'.  Then they can see new mockups, comment on features, get new releases and participate in team discussions on their particular project.

    So the first thing you should do is to create a 'Customer Portal' in your SharePoint extranet. Then give your customer a login, send them an email and they are now going to really get involved!

    There are many means by which you could provide this functionality to your client.

    If you are using SharePoint then....

    It is advised that you create a customized SharePoint Team Collaboration site template. That way you can very quickly initialize a new site, for each new customer.

    Once you have the template, follow these steps to create a customer portal with SharePoint 2007:

    1. Go to the root where you want to create a site
      eg. sharepoint.ssw.com.au
    2. Click "Site Actions" on right hand top, select "Manage Content and Structure

     Manage Content and Structure

    Figure: The first step to creating a 'Customer Portal' is to select 'Manage Content and Structure' to view site collection

    Once the new window opens, on the left hand side, click on the 'Clients' dropdown select New-> Site.
    Note: If you don’t see this option, that means you don’t have permission to create site.

     Create New Site

    Figure: Create new site

    Now follow these steps when the new window opens fill in the fields below.

    Info to create site 

    Figure: Fill in the appropriate info then click "Create"

    More Information:

    1. Fill in the fields for the new client site
      eg. Title, Description and URL
    2. Select the template
      e.g “ClientCollaboration_V1” in the Custom tab.
      Note: Your selection is confirmed in the picture. In this example the template’s description looks like “Site for Collaboration with SSW Clients”.
    3. Select “Use Unique permissions” as you need to give the client an account to visit.
    4. In the “Navigation Inheritance” choose “No” as you don’t need to let client visit the other client sites via the navigation.
    5. Click “Create

     

    Next step is to setup the groups and permissions.

      Figure: Create a 'new group' or select an 'existing group' for the newly created site.

    More Information:

    • Permissions: After you created the website for the client project, you need to configure the permission to make sure the developers and the clients can visit the site with the current authority. By default:
    1. Visitors to the site - Read :
      • Visitors need to read most of the site.
      • They can't read team discussions (not used)
      • They can download from 'release files' document library.
      • They can synchronize their calendar to the team calendar in SharePoint (not used - one day it should read from CRM)
    2. Members of this Site - Contribute:
      • Can view, add, update and delete.
    3. Owners of this Site - Full Control:
      • Has a full control.

    In this case, we are using 'create a new group' option because we want this group to be able to access only for this perticular site  - It is a good practice to create a new group for every site you create, because it will be easier to add or delete users in the group for that specific site.

    Note: you can also access this through the "People and Group" option on "Site Action" link on right hand top of the page, if you need to manage permission in future.

    Click "OK", and the portal is created.

    Northwind Portal  

    Figure: View Northwind portal.

    Note: SharePoint will send "welcome email" to all the members of the groups you created for the site with basic information, but you still need to send email to your customer with the login details like Url, userName and Password.

  88. Do you know how to deploy the imported solutions to the new site collection

    Solutions must be deployed to the new site collection before the content database is resorted to the SharePoint 2010/2013 server:

    1. Open SharePoint Central Administration | System Settings | Manage Farm Solutions
    2. Click on Deploy Solution
    3. Refer to the table you completed in the rule Do you confirm your list of installed Solutions and deploy the solutions to the same site collections they were deployed to on the SharePoint 2007 server.
  89. Do you know to *never* touch a production environment with SharePoint designer?

    • SharePoint designer can silently reformat your code and introduce errors.
    • If you modify any master page or page layout file with SharePoint designer, it becomes customized. This means that SharePoint is now looking at a customized version stored in the database rather than the version on the file system. You then can't deploy future changes, because SharePoint will now always serve the customized version instead of the ghosted version in the solution package.
  90. Do you know the ASP.NET skills that do not translate (aka different) ?

    ASP.NET is file system driven, SharePoint is database driven – all SharePoint content and meta data comes from a database, include images, HTML, Master Page, etc. SharePoint provides a framework where components can be plugged in, and out of the box these areas are improved:

    • Security model, membership, permissions
    • There’s a relatively consistent UI framework
    • Menus, navigation and site maps
    • Administration of access, site owners can change permissions for that site – without admins

    Deployment model is very different:

    • ASP.NET has MSI file or XCopy deployment – individual server
    • SharePoint deployment is via Solution Package – but goes cross site farms
    • Deployment is both declarative in XML format, as well as in code with Feature and Event receivers

    Tools:

    • ASP.NET is mostly done in Visual Studio .NET
    • SharePoint development is split among:
      • Internet Explorer – SharePoint configurations (note: non IE browsers remain 2nd level and isn’t as good as IE with SharePoint)
      • Microsoft SharePoint Designer – SharePoint HTML page design and customization
      • Visual Studio .NET – custom web parts, custom workflows, solution packages