Archive for the 'SharePoint Customization' Category

22
Jun
16

Referencing a Custom Help Page with the Help.aspx page in SharePoint 2013

I was trying to find an easy way to navigate directly to a custom SharePoint help page and figured there must be some URL parameters I could use to get there.  However, all my searching only turned up snippets of JavaScript such as this one…which is okay, but I really wanted to understand what /_layouts/15/help.aspx page was really wanting.

var navBarHelpOverrideKey = “[Help Collection Product]_[Context Key]”;

If you look at the link provided by clicking on the help icon, you may see some links like these, once you navigate to the exact topic you want to view.

http://site.myco.com/_layouts/15/help.aspx?Lcid=1033&Key=HelpHome&ShowNav=true

Notice here you see AssetKey=.  This appears to expect some semi-colon delimited GUID on the parameter value.  I’ve found that using Key= is what you probably want to use.

http://site.myco.com/_layouts/15/help.aspx?AssetKey=/Lists/Site Collection Help/CustomHelp/LogonScreen/CustomTopic.htm;41fdd883-01d2-4c2a-9a25-4465d705c17a;

What I wanted to do was provide the exact topic in some sort of URL parameter.  What I found is you can use this format.  It is essentially the name of your folders you created in your custom help and the help page’s context key separated by underscores, e.g. Key=MyCustomHelpCollection_MyCustomHelpCategory_1.  The missing piece here is the Context Key added on the end.  This takes you directly to the page, without having to navigate through the Collection and Category.  Note that the URL parameter name you might be tempted to use is AssetKey=, while the correct URL parameter name to use for this type of navigation is simply Key=.

image

http://site.myco.com/_layouts/15/help.aspx?Key=%5BHelp Collection Folder Name]_[Help Category Folder Name]_[Help Page Context Key]

What does this mean?  This means that after you create a custom help library by enabling the feature and creating some content, as discussed in these articles, you can link directly to your topics if you need to.

Create a Custom Help Library to SharePoint 2013

Create a Custom Help Library for SharePoint Foundation 2010

It’s really possible this information exists somewhere out there, but I sure couldn’t find it after a couple hours of searching.

27
Oct
15

403 Forbidden Error on Custom FBA Login Page

We wrote a custom FBA login page and had it working in our QA system and were in the process of setting it up in our production system when we encountered a "403 Forbidden" error.  The page was written as a modification to the FBA pack on CodePlex and thus was located in the /15/template/layouts/FBA/OurCustomFolder directory.  After struggling with this for quite some time we finally realized we had set anonymous access on the site permissions in QA to "lists and libraries" (for another reason) and had not made that same change to production.

image

Making this change fixed our "forbidden" error. 

Interestingly, when using the out-of-the-box FBA login page, there was no issue.

06
Mar
13

Reordering and Hiding Fields and Passing URL Parameters on a New Item Form in SharePoint 2010

Let’s say you are creating a new item form using SPD 2010 and you don’t have InfoPath because the company didn’t purchase the Enterprise version of SharePoint.  Your goal is to pass a URL parameter to the new item form from some other part of the SharePoint application you are building.  Perhaps the link that contains the URL parameter was created by a workflow (hint hint).

image

You insert the custom list form like this.

image

The goal is to move this field down to the end of the form to get it out of the way.

image

You select the row and cut it for repositioning to the end of the form.

image

Now you’ve got it at the bottom of your form.

image

Now you test your form (before adding the parameter to pass) and it "works" but it doesn’t correctly save the data in the field you relocated.

The correct way to do this is to delete the field row at the top, add a new row at the bottom and insert a new text field and bind it to the column.

image

Bind the Data field to the column and format it as a Text Box.

image

Under Options, select Parameters and add a New Parameter, giving it a name that is memorable for you.  Then, bind it to the Query String variable of your choice.

image

With your text box selected, find the text property and change it from @Fieldname to $Parametername.

image

If you don’t get the name correct, you’ll see an error displayed instead of your form.

image

If you want to hide the field completely on the form to eliminate any human intervention, add class=ms-hidden to the table row.

image

03
Dec
10

Conditional Formatting and date comparisons with SharePoint Designer 2010

So here’s a fun one that we at SharePoint Rx were struggling with the other day. 

We were creating a dashboard using the DVWP in SharePoint Designer 2010 and had to perform some date comparisons to control the display of indicators.  If you’ve used SPD in the past, you know that the goal is to NOT write code, but to use the “coding by clicking” capabilities of SPD and allow it to write the code (in this case XSL) to control your conditional formatting.  Every time I use SPD for something like this, I always seem to run into a new problem, even though I know it should be a simple task. 

“Am I the only one with this issue?” he asks.

Here’s the end goal…to display a status indicator for tasks to indicate whether they were completed on time, completed late, not complete and not late, and not complete and late.  You can see the four icons I chose to indicate these statuses. 

image

My “conditions” are as follows:

clip_image001 Status equals “completed” and Due Date >= Completed Date

clip_image002 Status equals “completed” and Due Date < Completed Date

clip_image003 Status not equals “completed” and Due Date >= [Current Date]

clip_image004 Status not equals “completed” and Due Date < [Current Date]

One of the issues you immediately experience is the comparison of date values.  Using SPD, I did an “un-advanced” comparison in my condition statements and never got the correct results.  SPD wrote some XSL like this (I broke it up so it’s a little easier to read):

<xsl:if test=”normalize-space($thisNode/@Status) = ‘Completed’

and

ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($thisNode/@DueDate))) &gt;=
normalize-space(@Completed_x0020_Date)” ddwrt:cf_explicit=”1″>

<img src=”_layouts/images/kpinormal-0.gif” width=”16″ height=”16″ />

</xsl:if>

So we have a “Due Date” that has been operated on by ddwrt:DateTimeTick (see if you can find any documentation on this function) and is returning the number of days from January 1, 1900 comparing to the “Completed Date” in the form “MM/DD/YYYY.”  That doesn’t work!

Sidebar rant…Come on, Microsoft!  The only documentation on the ddwrt namespace is from a non-MS person (Serge van den Oever ) and is from 2005…for SharePoint 2003?

So, let’s look at the “Advanced” condition criteria that does work.

image

We used the completely undocumented ddwrt:DateTimeTick function and applied it equally to both dates.

image

When performing the comparison with [Current Date], here’s what we did.

image

We were successful with using the $Today variable, but I’ve seen others who have also used ddwrt:Today.

image

Here are the criteria for all four conditions.

@Status = ‘Completed’ and ddwrt:DateTimeTick(ddwrt:GenDisplayName(string(@DueDate))) >= ddwrt:DateTimeTick(ddwrt:GenDisplayName(string(@Completed_x0020_Date)))

@Status = ‘Completed’ and ddwrt:DateTimeTick(ddwrt:GenDisplayName(string(@DueDate))) < ddwrt:DateTimeTick(ddwrt:GenDisplayName(string(@Completed_x0020_Date)))

$thisNode/@Status != ‘Completed’ and ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($thisNode/@DueDate))) >= ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($Today)))

$thisNode/@Status != ‘Completed’ and ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($thisNode/@DueDate))) < ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($Today)))

Now, I’d like to believe that features in SPD 2010 that were in SPD 2007 were all functioning correctly, but I seem to have lots of problems using the “All formatting visible” functionality.  I found that each time I changed this I must

  • Save the page
  • Press F5 to refresh (sometimes more than once)

Not sure what that’s about or if it’s just one of my settings, but it sure is annoying.

image

Of course, the idea is that you want to make all your conditionally formatted elements visible so you can easily work on them.

image

FYI, if you want to determine which condition applies to which element, you can select the condition and you should notice a highlighting of the element to which the condition corresponds. 

image

Keywords:

Conditional formatting

SharePoint Designer 2010

Date comparison

Data view web part

ddwrt namespace

15
Oct
10

Let’s Make a Clickable Image Map Using SharePoint Designer 2010

…and I do mean Map!

Get your base image and copy it to the clipboard.  I’m going to use a map of the world.

image

On the asset-based navigation in SPD 2010, you’ll need to navigate to an object that will allow you to create an HTML file in it.  Here I’m using Site Pages, but you could also select All Files.  You probably want to save it somewhere so you can modify it later, if need be.

image

Open the file (Untitled_1.html) for editing.

image

Delete the HTML that came with the new page.

image

Paste your image into the page.

image

Click on the map image and then select Format under Picture Tools.  You’ll now have access to the Hotspot tool.  Select either the Polygonal, Rectangular or Circular Hotspot drawing tool.

image

Using your coloring skills you learned in Kindergarten, trace each of the areas you want to hotspot.

image

When you close the polygon, you’ll get a dialog where you can enter the address that the hotspot is linked to.

image

Copy all the source to the clipboard…

image

…and paste it into the HTML view of a content editor web part.

image

You should see it displayed with the regions visible.

image

The finished product.  Hovering over an area will give you "the hand" and clicking will take you to your hyperlink.

image

11
Jul
10

Running the Content Query Web Part (CQWP) on a Team Site Without the Publishing Infrastructure Feature Enabled in SharePoint 2010

I was doing a little monkeying around (read that "book editing") with SharePoint 2010 and decided to see if the similar post I read by Sameer Dhoot was still true in 2010.  If you are missing the CQWP in SharePoint, you’ll find that activating the Publishing Infrastructure feature will fix the problem, as the CQWP is added/enabled as part of the Publishing Infrastructure.  Well, what if you want to use it in a team site for some reason?  Turns out you can still do it.

If you simply export the CQWP from the web part gallery of your publishing site and import it to the web part gallery on your collaboration site, you won’t run into any problems.

image

You can export the web part by clicking the Edit icon and selecting the Export function in the ribbon.

image

The problems will start to occur when you try and use it.  You’ll get errors when your page on which you’ve added the CQWP attempts to render the web part.

image

In this version of SharePoint, there is a Style Library in both collaboration and publishing sites.  The important difference is that the collaboration site Style Library is empty.  This is where the problem resides.  You can either copy the content out of the publishing site style library or, you can create a list template out of the publishing style library and save the content with the template. 

Since the publishing site does not have a "Save document library as template" link, you’ll have to create one on your own.  Navigate to the library settings on your Shared Documents library and select the "Save document library as template" link.  You’ll notice that this is using the _layouts/savetmpl.aspx page and it is passing the List GUID as a parameter  (/_layouts/savetmpl.aspx?List=%7B1C534D30%2D9F2F%2D41A5%2DAC98%2D51CD244F532D%7D).

image

Navigate to the publishing site’s Style Library settings page (_layouts/listedit.aspx).  Now simply change the listedit.aspx to savetmpl.aspx and press enter.  Fill out the form being sure to "Include Content" and save it.

image

You should get a successful save.  Now navigate to the list template gallery.

image

Right-click and save the list template (STP) on your computer. 

image

Now all you need do is navigate to your site template gallery on your collaboration site and upload the STP file.  Then you can delete the existing Style Library and create a new list called Style Library from the template. 

image

You should now feel the love the the CQWP in your collaboration site.

image

Further investigation shows that the CQWP needs these three style sheets in order to function correctly:  ContentQueryMain, Header and ItemStyle.  Removing any of these from the Style Library will cause the CQWP to throw an error.  So, you could probably just export these styles and import them into your collaboration site’s Style Library and accomplish the same thing.

image

19
May
10

Render Failed on SharePoint List Views

Today I helped a client solve one of the many mysteries around the infamous "Render Failed" that so many people seem to get at some point in time on MOSS 2007.  In this situation, the error started appearing on several list views and nothing had been changed for several weeks prior.

After some trial and error, I found the problem was tied to several site columns that were being displayed in the views.  The site columns were lookup columns and were used many places throughout the site hierarchy.  Of course, this happened on the same day that my son and daughter-in-law were having their first child (and our first grandchild), so I found myself troubleshooting from the waiting room at Medical City in Dallas.  I know this doesn’t have anything to do with the problem, but my son’s a new father and I’m a new grandfather…so sue me!  I’ve got a captive audience and I’m a proud grandpa.  🙂

CasonPose

Cason Noble Wright 2010-05-19

Anyway, it was really weird that nothing had been changed and this started and was fairly widespread.  After monkeying with filters, view styles, sorting, grouping to see if any of those things changed the outcome, I observed that, as I removed columns from the display, the views began to work.  That’s how I determined that the problem was tied to the site columns that were of the type "lookup."

To make things worse, later during the day the SharePoint site completely quit.  Now I suspected something was amiss on one of the servers.

This client has a simple two-server setup, so I VPN’d in to each server.  When I got on the SQL Server, I found that AUTOMATIC UPDATES was on and the machine had been updated and was awaiting a reboot.  Ah ha!  Finally a potential root cause. 

I quickly contacted the client and told them to reboot the SQL Server and the problem was solved.  And, TURN OFF AUTOMATIC UPDATES ON A PRODUCTION MACHINE!!!

Now, back to the grandbaby…

Reference Links:

Render Failed on a List View

KB950901

SharePoint Issues

KB925425

11
May
10

Multi-valued (Multivalue) Fields (Managed Properties) in Search not Returning All Values

Update 20100908:  Leslee completed this in the production environment and it worked the first time.  I’m calling it a wrap!

Update 20100826:  We just did this in our staging environment and got it to work the first time through!

Update 20100802:  I’ve rewritten this post a couple of times, adding more detail as we find it.  We think we might be on to finding "the recipe," but we’ll only know for sure when we repeat the process in the staging and production environments and get repeatable results.  This post is "in-work."

Oh man, this has been driving us CRAZY (just ask Leslee)!  We have a multi-valued column in SharePoint (Subject) and we couldn’t get all the values to show up in the search results.  All we could get is the last value.  See this post: Always returning last value.

We had different results before we upgraded to SP2.  In SP1, we were getting some weird results with some of the values being returned as ;#Value;# or some such nonsense.  We hope we don’t see that again.

Currently, we are on SharePoint 2007 SP2 with the February 2010  June 2010 cumulative update with the infrastructure updates installed.

There were a few hints from Ontolica (Surfray) from this post.

From this post by Michael Schau, we started to deduce a method to fix the problem.  Here’s what we came up with.

Overview:

  • Remove the mapping between your managed property and crawled property.
  • De-select the "Include values for the property in the search index" field on your crawled property.
  • Edit your crawled property category and select the checkbox to “delete all unmapped crawled properties.”
  • Reset all crawled content.
  • Perform a full crawl.
  • Add your mapping back between your managed and crawled property.
  • Change the HasMultipleValues column to True for your managed property in the MSSManagedProperties table in the Shared Services database (void your warranty).
  • Change the VariantType column to 4127 for your crawled property in the MSSCrawledProperties table in the Shared Services database (void your warranty again).
  • Perform another full crawl.
  • Perform an incremental crawl (not sure if this is really necessary, but it’s pretty quick).
  • Perform an IISRESET on all SharePoint boxes.

Let’s start with the ugly part first.  You’re not going to like this but, if MS doesn’t have software that correctly updates the database, then we’ll do it manually.  After all, it’s just a database!

Find your SSP database in SQL Server Management Studio.

image

Find the MSSManagedProperties table and open it for editing.  Locate your managed property using its FriendlyName and change the HasMultipleValues column to "True" (or 1).

image

image

Now find the MSSCrawledProperties table and open it for editing.  Locate your crawled property using its PropertyName and change the VariantType column to 4127.  We found when you change the VariantType to 4127 the Multi-valued field changes to "Yes."  All of the multi-valued fields we could find had this variant type.

image

image

The variant type for a text field is 31 (0000000011111).  The variant type that shows up on a multi-valued text field is 4127 (1000000011111).  Could it be that the leading bit identifies the field as multi-valued?  Here’s an incomplete table for the crawled properties in the SharePoint category.

Variant Type Multi-valued Decimal Binary
Text False 31 0000000011111
Text True 4127 1000000011111
Binary False    
Binary True    
Integer False 20 0000000000010
Integer True    
Yes/No False 11 0000000001011
Yes/No True    
Decimal False 5 0000000000101
Decimal True    
Date/Time False 64 0000001000000
Date/Time True    

image

You are done modifying the database.  Great job!  You’ve now voided your warranty.

Now we’re going back to Central Administration in the SSP where your search is located.

Remove the mapping for the crawled property from the crawled metadata store.  You can get there from the Metadata Properties page by clicking on Crawled Properties.

image

Find and edit your crawled property.  Remove the mapping and de-select the "Include values for the property in the search index" field.

image

Find your crawled property group (SharePoint in our case) and drill into it.

image

Click on Edit Category .

image

Select the checkbox to delete all unmapped crawled properties and click OK.

image

Reset all crawled content and perform a full crawl.  I hope you don’t have too much data!  Perhaps you should have thought to limit it before you started!

image

After the full crawl has completed, you need to add your property back.  It should be in the crawled properties.  You need to map it back to your managed property.  After you have it added back, perform ANOTHER full crawl, after which, you should see the property is correctly classified as multi-valued.

image

What does this get you?  Now, if you look at the raw XML search results for your managed property, you should see the multiple values returned.  In this example, we’re looking at a managed property called owssubject.

image

And, if you apply your XSLT, you should get something that’s nice looking, like this!

image

Search terms:

Multivalue fields in SharePoint search not returning all values

Multivalued fields in SharePoint search returning single value

Multivalued fields SharePoint search not working – broken

Can’t get multivalue field to return more than one result in Sharepoint search

01
Apr
10

Changing the Content Type on a SharePoint Page Layout

Here’s the situation.  You created a content type and a page layout based on that content type and then discover that you need to redefine content types. In fact, you find that you should have created a parent content type and had other content types inherit from it.  After reworking your content types and site columns you now want to change your page layout so it references the correct content type.  You can do this by visiting the Master Page Gallery in SharePoint and changing the Content Type Name on the properties page.  If you were looking for a place to do this in SharePoint Designer, I haven’t found it.

Now, when you go back to edit the page layout in SharePoint Designer, you won’t get all those nasty errors informing you that it can’t find the Page and Content fields because it can’t find the content type.

 

image

15
Feb
10

Changing the Group on a Site Column Causes Hidden Fields to Display on a Content Type

I ran into this problem recently.  I had a number of site columns that were hidden on multiple content types and I "recategorized" the site columns into a single group (simply for administrative purposes).  As a result, all my forms began displaying the hidden fields (instead of keeping them hidden).

Here’s the scenario.  I have a content type, Generic Task, that is used as the parent of many other content types.  You can see from my first screen shot that I have a content type (called Badge Access Task) that is inheriting from Generic Task.  When a user interacts with the task list Edit form I only want them to see and update the two fields at the bottom (Badge Access and Badge Access Comments).  All the other fields are hidden and are only used by workflows.  If you haven’t done this before, you can still see the hidden fields in a view, but the New, Display and Edit forms don’t show the hidden fields.

clip_image002[11]

 

Here’s the problem I was having.  After I changed the group that my Generic Task site columns were in, they all started showing up on my Edit forms.

 

clip_image002[13]

 

To correct this problem, I simply went into each site column on each content type and clicked OK.  I didn’t make any changes to any of the information on the form.

 

clip_image002[15]

 

This appears to have had the desired effect.  After performing this procedure on each site column on the content types, all of my fields were again properly hidden.

 

clip_image002

 

As an FYI, this is on an MOSS 2007 farm with SP2 (and patches) applied.




Asif Rehmani’s SharePoint Videos

SharePoint-Videos

Click to access a wealth of SharePoint videos

SharePoint Rx

SharePoint Rx Home

Categories

Posts by Date

August 2020
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930
31  
Support Wikipedia