Category Archives: SharePoint 2010

SharePoint Online Permissions

Overview of SharePoint Online’s “out-of-the-box” permissions:

Permission Restricted View Read Contribute Edit Design Full Control
Can view pagesYesYesYesYesYes Yes
Can view list items
and documents
YesYesYesYes Yes Yes
Download documentsNoYesYesYes Yes Yes
Can add, update
and delete list items
and documents
NoNoYesYes Yes Yes
Can add, edit and
delete lists
NoNoNoYes Yes Yes
Can approve
and customize
NoNoNoNoYes Yes
Has full controlNoNoNoNoNoYes

SharePoint Online permissions, listed in reverse order:

  • Restricted View
    View pages and documents, but not historical versions or user permissions
  • Read
    View pages and items in existing lists and document libraries and download documents
  • Contribute
    View, add, update, and delete list items and documents
  • Edit
    Add, edit, and delete lists; view, add, update, and delete list items and documents. By default, this permission level is assigned to the Members group
  • Design
    Create lists and document libraries, edit pages and apply themes, borders, and style sheets on the site. There is no SharePoint group that is assigned this permission level automatically
  • Full Control
    Contains all available SharePoint permissions. By default, this permission level is assigned to the Owners group. It can’t be customized or deleted.

For more information, see Microsoft pages:

SharePoint ‘Site Content and Structure’ Admin Page

There have been numerous time I’ve need to publish multiple documents in one go. You could use PowerShell or better still the UI…

Welcome to the Site Content and Structure administration page:
https://[TENANT].sharepoint.com/<SITE-PATH>/_layouts/15/sitemanager.aspx

The Site Content and Structure has been around since SharePoint 2007 and it really shows. But don’t let that get in the way of useful functionality. It is still available in SharePoint Online, even though the link has been removed from the Site Settings page.

Imagine you need to publish 50 site pages in one go:

  1. Navigate to the Site Content and Structure using the URL above
  2. Click on Site Pages, within the left navigation
  3. Select the pages to publish
  4. Click on the Actions menu and then Publish

You will see there are other options:

  • Copy…
  • Move…
  • Delete
  • Check Out
  • Discard Check Out
  • Check In
  • Publish
  • Unpublish this version

Perhaps Microsoft will revive the Site Content and Structure and give it the modern face-lift it deserves…? Vote here if you feel the same: https://sharepoint.uservoice.com/forums/329214-sites-and-collaboration/suggestions/37335316-bring-back-the-site-content-and-structure-page

SharePoint: Content and Structure Report for All Checked Out Files

Ever wondered why a file or page was not showing up in search or did not updated during a deployment? Well perhaps it was because the “creator” had not checked-in their file or published the page…

SharePoint has a useful page called Site Content and Structure which can be used to review the following out-of-the-box reports:

  • Checked Out To Me
  • Last Modified By Me
  • Pending Approval
  • My Tasks
  • All Draft Documents
  • Going Live Within Next Seven Days
  • Expiring Within Next Seven Days

The link to the Content and structure page can be found on a Publishing site’s Site Settings page.

What if however the file was check-out by someone else? Then an answer is to create your own report and here is how to do it.

Creating a Custom Report Definition

  1. Navigate to your Publishing site collection
  2. Click Site Settings, under the SharePoint Cog menu
  3. Navigate to the hidden Reports List, to create a custom report
    http://<Tenant>.sharepoint.com/Reports%20List/AllItems.aspx
  4. Click new item and enter the following
    • Report Title: All Checked Out Files
    • Resource Id: SmtAllCheckOutUser
    • SmtCheckOutUser: SmtAllCheckedOutReportDescription
    • CAML List Type:
    • CAML Query: <Where><Geq><FieldRef Name=’CheckoutUser’ LookupId=’TRUE’/><Value Type=’int’>0</Value></Geq></Where>
    • Target Audiences:
    • Report Description: All documents and pages checked out in this site and subsites
  5. Click Save

Review the “All Checked Out Files” Report

  1. Navigate to your Publishing site collection
  2. Click Site Settings, under the SharePoint Cog menu
  3. Click Content and structure, under the Site Administration heading
    http://<Tenant>.sharepoint.com/_layouts/15/sitemanager.aspx
  4. Click Default View and select

One limitation you may notice that your report does not display who has checked-out a file or page. It is however simple enough to find the location an individual file or page:

  • Clicking Opening Link in New Window
  • Clicking the View Properties and hovering over the Name

Client-side Development Techniques with CQWP(s) and JavaScript…

The other day I was talking to one of my colleague John Holah about retrieving large amounts of data from a SharePoint 2010 Lists using “client-side” v “OOB” techniques for a particular client, who has set use a number of challenges/limitations:

  • Our access is limited to Site Collections
  • We cannot deploy server-side code
  • Internet Explorer 8 is used by all of client’s employees (120,000 Users globally)

Depending on what the end goal, previously we used these techniques to retrieve data:

  1. CQWP* and write custom XSL to render the content as HTML
  2. Call a SharePoint web service using a JavaScript library call SPServices and
  3. populate an array or an object before rending it as HTML

Option 1: is relatively quick to implement, however it has a number of limitations:

  1. The source of the content is limited to either a Content Type or a List
  2. In my opinion, it is not as easy to apply logic to XSL as it is to JavaScript
  3. IE8 times-out if a large number of rows are rendered to the UI (this can vary depending on the number of columns as well as rows and the complexity of the HTML)

Option 2: is has flexibility, however:

  1. A call to a web service is not as efficient as the CQWP in retrieving data.
  2. A significant number of lines of code needs to be written to call web service (particularly if it’s asynchronous)
  3. Supporting custom code is time consuming as developer coding styles and techniques vary

So what if we combined the two techniques? Would we get the rapid development of the CQWP and flexibility SPServices? Well I’ll let you decide after I show you some code:

Step 1

As preparation create a new list called “Product Relationships” and add the following columns:

Column                      Type
-----------------------------------------
Product1                    Number
Product2                    Number

And add some items, for example:

Product1          Product2
------------------------------------------
 2                   13
 6                    2
13                   14
15                   16
18                   19
20                   18
20                   19

Step 2

Add a CQWP to a page, configure it to point to your new list and export (save to your local machine for editing).

Step 3

Add the following directory structure to the “Style Library” directory of you site collections root sites:

\Branding\XSL\MyWebpart

And upload the MyWebpart.wepart file having add the reference (path) to the XSL file (you will create shortly):

  • ItemXslLink
  • MainXslLink
  • HeaderXslLink

And then edit the element called “Xsl”.
Once completed the file should look something like the following:

Step 4

Create a copy of the ContentQueryMain.xsl file located in  “\Style Library\XSL Style Sheets\” and edit it so that it looks something like this:

The lines of code to look at in detail starting from the top are:

<script />

The tag referencing the “_temp.js” file, this would normally be placed in the master page, however for the demo it is here.

<div id="relationshipEditor">…</div>

Used by the JavaScript to inject the demo content.

<script>…</script>

Wraps around the XSL template which will populate a JavaScript Array.

var pr = SJLewis.ProductRelationships;

Creates is a shortcut to a JavaScript Namespace.

<xsl:call-template name="populateArray" />

Does what is says, called the populateArray template.

<xsl:for-each select="$Rows">…</xsl:template>

Loops through the list items.

pr.productRelationships.push(new pr.productRelationship(…));

The “new pr.productRelationship(…)” code creates a new object containing data from the list item. And “pr.productRelationships.push()” add the object to the array.

pr.doSomeStuff();

Is a function that loops though the array and added the content to the page.

Step 5

Create a new JavaScript file for called “_temp.js” and add the following code:

And upload to this directory:

/MySiteCollction/Style Library/Branding/HTML/MyWebPart/_temp.js

Step 6

Reload the page and as baring no errors you page may look something like this:

Test 20 - 20
Test 20 - 20
Test 18 - 18
Test 15 - 15
Test 13 - 13
Test 6 - 6
Test 2 – 2

This model could easily be extended to retrieve data from multiple Content Types or Lists by adding more CQWPs and then exposing more objects and arrays from the “SJLewis.ProductRelationships” namespace. And instead of each CQWP calling the “doSomeStuff()” function to populate a DIV tag, they could call a “trigger()” function that informed a custom event handler when the data is loaded and ready for processing (e.g. combined, filtered and displayed by a div exposed by a CEWP).

XSL / JSRender Trap (Updated 14/07/2014)

When adding properties to a HTML tag located within your CQWP’s XSL file, which the value will be populated by JSRender, be sure to escape the curly braces like this:

Otherwise the XSL parser will strip the {{attr:ID}}} from the tags properties and the HTML will be rendered like this {attr:ID}.

CQWP Cashing(Updated 16/07/2014)​

Can’t see your new data and you need to see it immediately? Sounds like you need to turn off Caching. To do this, export the webpart and edit the property called “UseCache” by changing its value to “False”. The result should look like this:

Next save the webpart file and upload to your “Web parts” gallery and the final step is to replace the original webpart with using your new definition.

Glossary of terms:
  • CQWP:  Content Query Webpart
  • CEWP:  Content Editor Webpart
  • OOB:     Out of the box​

Disable mobile auto-redirect for SharePoint anonymous access website

The quickest way for all mobile devices and browsers add the following to the web applications web.config file:

However for a more granular approach, edit the App_Browsers\compat.browser changing the following to “false” for the relevant userAgent:

SharePoint: Enable Publishing features

To use the Web content management features, you need to turn on the Publishing feature on a site or site collection. You can then brand the site so that it has your corporate look and feel, and enable users to edit the corporate site within the context of the Web. Once the Publishing functionality has been turned on, you can also create a multilingual site by creating a source site and then translating the site into other languages, which can be publish as separate sites.​

Enable the SharePoint Server Publishing Infrastructure feature for a site collection

Use the following procedure to enable the SharePoint Server

Publishing Infrastructure feature at the site collection level.

  1. To enable the SharePoint Server Publishing Infrastructure feature for a site collection:
  2. On the Site Actions menu, point to Site Settings, and then click Modify All Site Settings.
  3. Note: If you do not see additional items when you point to Site Settings, click Site Settings.
  4. If you are not at the root of your site, under Site Collection Administration, click Go to top level site settings.
  5. On the Site Settings page, under Site Collection Administration, click Site collection features.
  6. On the Site Collection Features page, next to Office SharePoint Server Publishing Infrastructure, click Activate.

Enable the SharePoint Server Publishing feature for a site

Use the following procedure to enable the SharePoint Server Publishing feature for a site.

To enable the SharePoint Server Publishing feature for a site

  1. On the Site Actions menu, point to Site Settings, and then click Modify All Site Settings.
    Note:  If you do not see additional items when you point to Site Settings, click Site Settings.
  2. On the Site Settings page, in the Site Administration section, click Site features.
  3. Next to Office SharePoint Server Publishing, click Activate.

The source of this information is located here: http://office.microsoft.com/en-gb/sharepoint-server-help/enable-publishing-features-HA010157772.aspx

 

Definition of a SharePoint Feature

Represents a modular server-side, file system-level customization that contains items that can be installed and activated in a SharePoint environment within one of the following scopes:

  • Farm                       (Exclusing SharePoint Online)
  • WebApplication   (Exclusing SharePoint Online)
  • Site
  • Web

SharePoint: How to Update a Site Collection Date Format

A step-by-step guide on how set to a Site Collection’s Date Format

  1. Navigate to the root site* within your site collection and then follow these steps:
    Click on [Site Actions] –> [Site Settings], the Site Settings page will load.
  2. Under the Site Administration section of the Site Settings page click on Regional Settings link, this will load the Regional Settings page.
  3. Click on the Local drop down list and select the required language setting, e.g. English (United Kingdom). The page will reload to reflect your selection.
  4. Next, if your site collection contains sub-sites then, check the checkbox to have all sub-sites inherit these Regional Settings.
  5. And finally, click on the [OK] button.

*It is possible to update sub-sites; however updating the root (parent) site collection gives the opportunity to update all its sub-sites at the same time.

Tip: When the Site Settings page loads, if you see the Go to top level site settings link under the Site Collection Administration section then you can click on the link to navigate to the root site collection’s Site Settings page.​