Tuesday, June 18, 2013

How to hide web parts on Publishing pages

Problem

Enabling the Publishing feature modifies the options immediately available for web parts. For example, the web part Hide option is no longer enabled, when going to the Edit Web Part menu. 

Solution

Append the following to the page URL containing the web part you wish to hide:
?ToolPaneView=2
This opens the edit view of the page with the Hide option enabled.

 

How to Hide the Recently Modified Quick Links section

Problem

You have created SharePoint 2010 website.  You then modify existing and create new web pages for this site.  When your users then navigate to this site, they see the Recently Modified quicklaunch section appearing in the left navigation area.  The appearance of this section  causes their normal quicklaunch to move downward.  This section serves your users no practical purpose.  You want to hide this section from a page without modifying the master template page.

Solution

The Recently Modified quicklaunch uses the S4-RecentChanges class.  By adding a new style section to your page, you can cause the quicklaunch section to be hidden:
<style>   .S4-Recently Modified { display: none;} </style>
References

Monday, June 17, 2013

An Error has occurred while accessing the SQL Server Database or SharePoint Server Search service

Problem

You configure and start a new User Profile synchronization service.  After starting the service, you attempt to configure a new Synchronization Connection. On navigating to the Synchronization Connections page, you experience the following error:


When you click on Create New Connections, you experience the following error:


Solution

Restart IIS

Then go: CA > Application Management > Manage Service Applications > User Profile Service Application > Synchronization > Configure Synchronization Connections

The first error will no longer appear and you can now create a new connection.

 

Monday, June 3, 2013

TIP: How to Change DVWP Column Titles

Introduction

There are a couple of ways in which you can change the title of a Data View Web Part column in SharePoint 2010.  You can simply select and delete the column title and then enter your own.  You can also take the more elegant approach and edit the XSL that generates the column title.  The latter approach will be shown here.  It employs SharePoint Designer 2010.

Procedure
  1. Using SharePoint Designer 2010, open the page containing the DVWP.
  2. In Code View, search for the following string:
    <xsl:call-template name="YourFieldTemplate"...
    
  3. Within this group, look for the following line:
    <xsl:with-param name="fieldtitle" select="fieldtitlename" />
    
    to
    <xsl:with-param... select="YourCustomFieldName" />
    
Summary

Happy Coding!

TIP: How to Change a DVWP field to Configurable QueryString Hyperlink

Introduction

If you're building dynamic pages employing query-strings methods, you may want to employ the Data View Web Part (DVWP) to generate a list of query string hyperlinks in order to build master-detail pages and other custom dashboards.  The problem is, the DVWP doesn't present fields as hyperlinks OOTB and the hyperlink options are limited.  Additionally, the DVWP doesn't identify individual fields in the XML markup that you can modify.  However, using SharePoint Designer 2010, you can make Designer expose the XML to the fields you want to modify as hyperlinks. The following procedure shows you how.

This procedure assumes that you already have an ASPX page that you want to modify and that you have already dropped on DVWP onto this page and connected it to a list.

Procedure

1) In the DVWP, select the field that you want to turn into a query string hyperlink. 

Selecting the field causes a Tasks link to appear next to the field: Common xsl:value-of Tasks.  Alternatively, you can right-click the selected field, which opens a popup menu.

2) From the Tasks menu, choose Show Link to Item.  This changes the field into a hyperlink that points to a form. 

Don't worry about the extra XML: you can remove it.  More importantly, this action causes SharePoint Designer to modify the underlying XMLso that the appropriate XMLfield is exposed so that you can edit it.

3) Review the code and look for the fieldname associated with the field you selected.  You should find something like:
$thisNode/ @ FieldName
(NOTE: there are no spaces before and after the "@".  These spaces were added to prevent this HTML editor from automatically configuring this as an email address.)
Remove the XML that points to a new form.  This line is now ready for you to modify as needed in order to implement it as a query string.

Summary

In this posting, you have explored how to use SharePoint Designer 2010 to expose the XML associated with a specific DVWP field so that you can modify this field XML as a hyperlink.

Further Reading

TIP: Add a Simple Modal File Upload Link

Introduction

In the following procedure, you will walk through how to add a simple modal file upload link to any SharePoint page.  The approach uses SharePoint 2010's own markup.  It really is that simple.

Procedure

1) Go to the SharePoint 2010 document library to which you want to upload files by clicking the link.

2) View the source of this page.

3) Search for Add Document.

4) Copy all markup from (and including) <a to .../a>.

5) Paste this markup to the desired location in your SharePoint 2010 page.

6) Optional: Also copy and paste the <span... .../span> tag and content just preceding the above in order to get the neat + icon.

Summary

Happy Coding!

TIP: Show Grouping Toolbar Permanently

Introduction

The Grouping toolbar can be added to any page by choosing the Grouping Toolbar option from the Design tab's Options button.

By default, the Grouping Toolbar is hidden on a web part page until the user clicks the Filter link.

But what if your customer wants this toolbar displayed permanently?  No problem: the following procedure shows you how.

Procedure

  1. Open the page in SharePoint Designer 2010.
  2. Go to the page's code view.
  3. Do a search for the following text:
    <xsl:if test="$dvt_adhocmode = 'filter'" ddwrt:cf_ignore="1">
    .
    .
    .
    </xsl:if>
    
  4. Remove just these lines - but leave the markup encapsulated by this XSL:IF statement.
References

Sunday, June 2, 2013

TIP: Get User Properties from AD

Sometimes you may want to get all of the properties associated with an active directory user.  This can be easily done using PowerShell.  Here's the script:
Get-AdUser -f {sn -eq 'name'} -properties * | Get-Member
Where:

-f is the filter
sn is the LDAP "sirname" or last name
-eq means equal to
-properties sets what properties you want about the user
* indicates that you want all of the properties for the selected user

If you want to search by first name, use the following script:
Get-AdUser -f {GivenName -eq 'name'} -properties * | Get-Member
 References

Using the Chart Web Part: Tips and Procedures

Introduction

This posting consolidates notes on using the Chart web part.  It includes notes for both 2010 and 2013.  In most cases, notes written for 2010 can be applied to 2013.

Deploying the Chart Web Part

The Chart web part is immediately available in the Enterprise version of SharePoint 2010 [1,3].  However, it is also available in the Standard version if you know how.  To make it available in SharePoint 2010 Standard, you will need to specifically add the web part to the site collection from the Web Parts list [2].  To do this, go:

[yoursharepointsite]/_layouts/NewDwp.aspx

This takes you to the undocumented page, Web Part Gallery.  Scroll down until you find the Chart web part.  Select its checkbox, and then click the Populate Gallery button at the top of the page.  Now go back to your draft page, and again work through the process of adding a web part to a page [3].

Add Axis Interlacing (Bands)

Configure an Alternating Bands (Banded) Background

1) Go to Advanced Properties
2) Select Chart Areas
3) From the Axis menu, select the desired axis
4) Scroll down until you find the Appearance group of settings, and then set Interlaced = TRUE
5) Also in this group, set the InterlaceColor = [desired color]

Angle Axis Labels

1) Go to Advanced Properties
2) Select Chart Areas
3) From the Axis menu, select the desired axis
4) Scroll down until you find the Labels group, and then set Angle = [desired angle]

Hide the Data & Appearance Advanced Properties toolbar

1) Open the page in SharePoint Designer
2) Locate the Chart View Web part in Code View
3) Search for ShowToolbar, and set it to False.

Cannot remove second chart area
  1. Re-assign any series currently assigned to the second chart area back to the first.
  2. Remove any titles assigned to the second chart area.
  3. For both chart areas, for the Alignment settings, set the AlignWithChartArea back to NotSet.
  4. Not ensuring these settings changes will cause any attempt to delete the second chart area to fail.

References
  1. SharePoint Config Blog: SharePoint 2010 Web Parts by License Type
  2. Al's Tech Tips: SharePoint 2010 Shortcuts and General Aids
  3. SharePoint 2010’s Chart Web Part
  4. Microsoft Office: Introduction to the Chart Web Part
  5. SharePoint Solutions: The New Chart Web Part in SharePoint 2010

The List does not Exist

Problem

You have a SharePoint 2010 standard or enterprise farm. You want to create a custom site/page layout.  You go:
Site Actions > Site Settings > Master Pages
You select the Documents tab, and then click the New Document button in the ribbon.  You then experience the following error:
The list does not exist
You are able repeat this experience. 

Solution

There are many possible causes for this error, and you can find extensive discussion on the web regarding this error.  Before trying these various solutions, be sure to verify that SharePoint Server Publishing has been activated.  To do this go:
Site Actions menu > Site Settings > Site Actions section > Manage site features
Scroll down the list until you find SharePoint Server Publishing.  Verify that it has been activated.  If it hasn't, click Activate.  Once this completes, return to the Master Pages page and again attempt to create a new layout page.

References

Search not Indexing Webpart Content

Problem

You have a SharePoint 2010 farm.  You use unique permission settings in some sites for some pages and web parts.  You create new pages and content, using Dataview, Content, and other web parts.  You run a SharePoint 2010 Search crawl of the new content. You check the crawl and discover that the pages are being crawled, but discover that the new content is not being indexed. You investigate this further and find that all new content on all pages is not being crawled.

Solution

The problem likely involves the site settings Search and Offline Availability.  The setting can be found here:
Site Actions > Site Settings > Site Admin > Search and offline availability
By default, the Indexing ASPX Page Content setting is set to Do not index Web Parts if this site contains fine-grained permissions. OOTB, this settings causes no problems.  However, once you begin to implement unique permissions for some sites, such as for example, hiding content on some pages from some user groups, this setting becomes problematic.  Once unique permissions are implemented, the NOINDEX property is set for web parts.

The solution is simple: set the Search and offline availability setting to Always index all Web Parts on this site.  Then re-run the crawl.

References