SP Insider - A SharePoint Blog

SharePoint 2010 Workflow history error: “The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.”

 This is an interesting error message. When trying to see the workflow history of a SharePoint 2010 custom workflow I get the following error message:

 SharePoint 2010 Workflow history error: “The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.”

 
What was strange was that other workflow histories worked fine, so I went down the path of finding out where the limit was. My first stop was the “hidden” SharePoint history list. There is a good post on this here:
http://www.sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?ID=111

 So I looked at my list by appending the /yoursite/lists/workflow%20history

 I added a count column to one of the fields, and it said 12,500. I knew that wasn’t right, so it must be a limit being returned somewhere. I needed to go deeper.

 I loaded SharePoint 2010 manager from Codeplex onto the server and found that my top secret workflow [...]

All SharePoint 2010 Color Themes with Pictures

They don’t make it that easy for you to see all SharePoint 2010 color themes at once, so here they are. I’ve taken the screenshots of the different theme settings and each default color. I’ve left the font as the default Verdana.
You can change the them at Site Actions-Site Settings-Site Theme under the Look and Feel section of SharePoint 2010.
This will save 30 minutes of your life that you will never get back.

 Default (No Theme)

 Azure

 Berry

 Bittersweet

 Cay

 Classic

 Construct

 
 Convention

 
 Felt

 
 Graham

 
 Grapello

 
 Laminate

 
 Mission

 Modern Rose

 
 Municipal

 Pinnate

 Ricasso

 Summer

 Vantage

 Yoshi

 
 

How to create a separate Infopath View for viewing only, for an infopath List Form in SharePoint 2010

 In InfoPath 2010, got to Page Design, new View:

 Copy the whole view from the Edit View, then paste into the new view and clean up any fields (for example take out descriptions).
Save the view as “DisplayView” or another name.
Set it as the default for viewing under Form Options:

By |September 25th, 2012|Sharepoint on Premise|0 Comments|

Delete All User Alerts for a SharePoint Site Collection

In SharePoint 2010, you can turn off all alerts through Central Admin under Application Management, Web Applications, General Settings:

 

 Another option is to write a little utility.

 I wrote a little WinForms utility to delete all user alerts in a site collection. We needed this when we backposted a content database from Production down to QA. We didn’t want to start firing alerts off the QA environment so you could either disable SMTP outgoing email or just wipe the alerts.

 How to do it: Create a WinForms Application in Visual Studio, add a few fields, buttons, radios.

 The Verify Alerts just checks your data without actually deleting it so you can see what you would have deleted.

 

 
 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.SharePoint;

 namespace DeleteUserAlerts
{

public
partial
class
Form1 : Form
{

public Form1()
[...]

By |September 12th, 2012|Sharepoint on Premise|0 Comments|

Migrate Alerts from old SharePoint url to new SharePoint url

Here’s a handy powershell script to migrate all alert url’s.

 Problem: When you perform a content database migration to a new SharePoint farm with a different url, the alerts will not fire as the url’s are stored from the previous farm.
For example, migrating from “Intranet” to “IntranetQA” will not work as the old url’s are stored.
Here’s the script:
http://gallery.technet.microsoft.com/ScriptCenter/877d2abd-fce9-4545-b223-7637936dd888/

By |September 12th, 2012|Uncategorized|0 Comments|

Customize Infopath Forms in SharePoint 2010 changes color theme to default blue (no visual upgrade)

I ran into this one when trying to customize a SharePoint 2010 form using the “Customize Form” button to add some custom colors on an InfoPath form for a SharePoint list. If you perform a visual upgrade in SharePoint 2010 everything works fine. However, if you do not do the visual upgrade, the page does not respect your color theme and reverts to the default “blue” theme.

By pressing F12 in Internet Explorer, you can see what is going on:

Notice how the core.css file is written out correctly and then overridden by the Obsidian color theme correctly.

However, what is happening is that Infopath is adding another reference to core.css after the Obsidian color theme.

Lines 7 and 8 of the “View Source” html show the correct order of CSS references with Obsidian after core.css

However, InfoPath adds the following reference to core.css which overrides the Obsidian theme on line 30.

Solution:

Open the Editifs.aspx [...]

Deleteing multiple event receivers error: Collection was modified; enumeration operation may not execute.

 This MSDN article has a nice section on adding and removing event receivers.  However, after trying their code below to delete an event receiver, it will fail if you try to remove multiple event receivers.

you will get this error:

Collection was modified; enumeration operation may not execute.

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            SPSite sitecollection = properties.Feature.Parent as SPSite;
            SPWeb site = sitecollection.AllWebs[“Docs”];
            SPList list = site.Lists[“MyList”];
            foreach (SPEventReceiverDefinition rd in list.EventReceivers)
            {
                if (rd.Name == “My Event Receiver”)
                    rd.Delete();
            }

To remedy this I specifically get the GUID’s of each event receiver and then delete them declaratively..

  public override void FeatureDeactivating(SPFeatureReceiverProperties properties)

        {

            SPSite sitecollection = properties.Feature.Parent as SPSite;
            SPWeb site = sitecollection.AllWebs[“Site Name”];
            SPList list = site.Lists [“List Name”];

            Guid Event1_Added = Guid.Empty;

            Guid Event1_Updated = Guid.Empty;

            foreach (SPEventReceiverDefinition rd in list.EventReceivers)

            {

                if (rd.Name == “Event1_Added”)

                {

                    Event1_Added [...]

My new friend to show all event receivers on a list

http://spm.codeplex.com/

Download the exe.  It provides a nice interface to drill down and show all the event receivers on a given list.

A few notes on event receivers:

In MOSS 2007, the Item Adding event has a null SPListItem, so use the properties.AfterProperties to get or set the fields before the item is added.  Also, the ItemID is null as the item has not been created yet.

If using Item Added, you can access the list item through properties.ListItem.

Use a Feature Receiver to deploy the event receiver.  This can be a class in the same project that installs on feature activate, and uninstalls on feature deactivate.

 

 

PreUpgrade Check fun

Great article for fixing pre upgrade related issues:

http://sharepointreporter.wordpress.com/2010/07/30/fix-pre-upgrade-check-errors/

One thing to add.  Use the query here to find the name of the pages that contain the offending webparts.  I thought deleting the page would make them go away, but I was wrong.  I had to recover the pages that I deleted from the recycle bin and then open them in web part maintenance view (appending “?contents=1” to the url and then delete the webparts from the page.   http://surfpointtech.com/2012/06/28/how-to-find-a-sharepoint-webpart-name-from-the-id-or-guid/

 Here’s the STSADM commands:

STSADM -o preupgradecheck

and this one to find the sites that the webparts live in:

stsadm -o enumallwebs -includewebparts > i:tempwebparts.txt

Better yet, use the SQL command above to get the actual page that the webpart lives in.

 

How to find a SharePoint webpart name from the ID or GUID?

SELECT DISTINCT D.SiteID, D.WebId, W.FullURL as WebURL, D.Id As DocumentId, 
                D.DirName, D.LeafName, tp_ID As WebPartSK 
FROM       dbo.Docs D WITH (nolock)  
INNER JOIN dbo.Webs W WITH (nolock) ON D.WebID = W.Id 
INNER JOIN dbo.WebParts WP WITH (nolock) ON D.Id = WP.tp_PageUrlID 
WHERE WP.tp_ListId Is Null AND WP.tp_Type Is Null AND WP.tp_Flags Is Null 
      AND WP.tp_BaseViewID Is Null AND WP.tp_DisplayName Is Null  
      AND WP.tp_Version Is Null 
AND WP.tp_WebPartTypeId='<your web parts id>’ 

Source for this query is Ryan’s comment her:

http://stackoverflow.com/questions/1498409/sharepoint-find-where-webpart-is-in-use