Tuesday, December 14, 2010

WSS 3.0 “Audiences”

A client recently had a requirement to hide web parts that certain Users do not have access to. Typically I would try to avoid all of this by including this requirement while developing Site Governance, but unfortunately Governance was not in the project scope nor were the dollars… So this left me to brainstorming various ways to go about appeasing my client. The most obvious was to accomplish this is by using Audiences, but unfortunately this is only available in MOSS and they were running WSS. The next option was to utilize SPSecurityTrimmedControl tag. This seemed like a good idea except it only trims based on a permission set and still displays web parts to doclibs/lists that some groups didn’t have access to... The final solution to this problem I decided on was to run server sided code on the page…  Here here a breakdown of the process and the code used:

Initially you must include your page in the web.config’s <pageparserpath></pageparserpath> (if you do not you will get an error regarding page not allowing code blocks).

Web.Config Example:

pageparserpath

Next you will need to create a new web part zone and move each web part that you wish to control, and initially set the visible property to false.

Zone Example:

webpartzone

Now we are ready to move on to the page code.The first part of the code retrieves current users SP Group Memberships and checks whether user is a Site Collection Admin or not.

<script runat="server" type="text/c#">
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);
        string spGroups = "";
        string isAdmin = "";
    bool admin= SPContext.Current.Web.UserIsWebAdmin;
        foreach (object o in SPContext.Current.Web.CurrentUser.Groups)
            {        
        isAdmin = admin.ToString();
        spGroups = o.ToString();
        System.Web.UI.WebControls.WebParts.WebPart control=null;

The next part of the code checks to see if the currently user is part of any of the declared SharePoint groups and in return changes the specified web part zone (web part zone ID) visible on the page.

switch (spGroups)
           {
               case "SharePoint Site Owners":
                       g_F915659D5D314C5094F0D177B93063F4.Visible=true;
                   break;
                case "SharePoint Site Members":
                      g_091EC81912CE4EE8AF93EE781B502B80.Visible=true;
                   break;
               default:
                   break;
           }

The last part of the code is thrown in to allow Site Collection Administrators to open all web part zones regardless of membership.

            switch (isAdmin)
            {
                case "True":
                       g_F915659D5D314C5094F0D177B93063F4.Visible=true;
                       g_091EC81912CE4EE8AF93EE781B502B80.Visible=true;
                    break;
                default:
                    break;
            }

            }
    }
</script>

And thats it! Put it all together and you have a method to apply “Audiences” to web parts on a page.

Tuesday, November 2, 2010

2010 In-place Upgrade & Service Application HTTP 404 Errors

Granted the In-place Upgrade process that Microsoft has released with 2010 is a HUGE improvement over what they provided us with for a 2003-2007 in-place, I still cannot say I head over heals for it...

Lets start by talking about what SharePoint 2010 In-place upgrade does very well… The obvious attraction to an in-place (assuming your hardware and software meets minimum requirements) is that it will upgrade your configdb, web.configs, contentdb, split up your ssp to corresponding service apps in one quick swoop. It will even upgrade some of those pesky FAB 40 and other solutions you deployed.

Sound too good to be true? It can be… Be wary! Things are not always as they may seem. Unfortunately there are some situations where you may have corruption in your Search DB or SSP DB that you are unaware of (and are not reported in the preupgradecheck report). This will allow the SSP to split into corresponding 2010 service application and not report  errors, but not provision properly. A good sign that you have fallen victim is to try to start and stop the service app service. I found that I could not stop/start a some of my services from CA, and I could only accomplish the task via command line. To make things worse, deleting the service app and recreating leads to the same problem.

After struggling with this phenomenon I finally gave in and uninstalled 2007, uninstalled 2010, cleaned by the SQL instance, performed a clean install of 2010,launched the grey wizard (psconfig wizard), and launched the white wizard (2010 config wizard), created new web applications, and attached my content databases. This resolved my issues

In summary, though an in-place upgrade has its advantages when dealing with custom solutions. I am still a proponent of standing up a clean environment and utilizing the database attach method regardless.

SharePoint 2010 Document Type Icon

I recently finished up a 2010 upgrade for a client whom relied heavily on using the document type icon to open their document in their document libraries. It appears that this functionality is no longer supported in 2010 (even though it explicitly says in the ViewEdit.aspx page “Title- (icon linked to document)”.

There is good news! The fine community @ CodePlex have released a solution called “DocIcon”. You can download it from the following link:

http://docicon.codeplex.com/

This solution should really only be a temporary fix and NOT utilized in the long-term. Hopefully MS addresses this problem, but in case they do not release a fix to this problem- I would suggest using this temporary fix until you get all of your views updated.

Wednesday, September 22, 2010

MOSS 2007: People Search & All Sites Scopes Missing

I ran into a situation where after creating a new web application, site collection, and configuring the crawler “People Search” and “All Sites” was missing from the search scope. They existed in the top-level site collection search scopes but the only option available was “This Site:Intranet”.

Solution:

Rename the default “Search Dropdown” to something else, and create a new search display group name “Search Dropdown” (assuming your using english language packs). Make sure you specify to include People and All Sites in the scope group, and set your default scope.

Once you have recreated the scope, head into search settings and specify a custom scope page (using the default _layouts/ossearchresults.aspx works fine).

Tuesday, September 7, 2010

Error installing SharePoint 2010 RTM after uninstall of Beta

I decided to save myself some time by installing SharePoint 2010 RTM on a server that was previously running 2010 beta. Lets just say that it was not so short and simple…

License upgrade in Central Administration. LICENSE UPDATE FAILED

Install RTM over Beta. PSCONFIG FAILED

Uninstall beta and install RTM. PSCONFIG FAILED

Ok… Now what? Lets take a look at the event viewer…

Description:
Failed to create the configuration database.
An exception of type System.InvalidCastException was thrown.  Additional exception information: Unable to cast object of type 'Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection' to type 'Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection'.

Seriously?! A .NET error… Gimmie a break. After reregistering .NET I ran across another blog that addressed the issue.

http://www.sharepointassist.com/2010/07/14/geneva-error-exception-system-invalidcastexception-unable-to-cast-object-of-type-microsoft-identitymodel-configuration-microsoftidentitymodelsection-to-type-microsoft-identitymodel-configura/

SOLUTION:

Open the web.config file (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\Root) and manually update your .NET version from 1.0.0.0 to 3.5.0.0.

<section name="microsoft.identityModel" type="Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

Create a new ConfigDB next time you run PSCONFIG.

Orphaned Application Pool in ConfigDB

I ran across a new type of orphaned data in the config database while at a clients the other day. I was in the process of adding a new SSRS server to a MOSS 2007 farm when it started failing on step 2 with the following error:

09/02/2010 22:17:33  8  ERR                      An exception of type System.InvalidOperationException was thrown.  Additional exception information: 1387
System.InvalidOperationException: 1387
   at Microsoft.SharePoint.Win32.SPNetApi32.NetLocalGroupAddMember(String groupName, String userName)
   at Microsoft.SharePoint.Administration.SPProvisioningAssistant.AddGroupMember(String username, Int32 group)
   at Microsoft.SharePoint.Administration.SPProvisioningAssistant.ProvisionProcessIdentity(String strUserName, SecureString secStrPassword, IdentityType identityType, Boolean isAdminProcess, Boolean isWindowsService, String strServiceName, Boolean dontRestartService)

(After banging my head against my desk for a few hours)I took a look and see if the PSCONFIG wizard added any of the application pool to IIS. I noticed that it was attempting to provision a app pool that doesn’t exist! This typically would not be a problem, except that the identity account it was using was local to their WFE server!

At this point, I attempted to simply change the account to the DOMAIN web application account and re-run the PSCONFIG wizard. Aaannnndddd it failed again as it simply attemped to provision the app pool again with the wrong account. So I returned to the drawing board…

SOLUTION:

If you are still reading this then you really must need to resolve this issue. I will give you two methods. The second method below is to be done at your own risk. Please read carefully and take your time (or you might get yourself into a worse situation).

Your FIRST choice to solving this problem is to disconnect your your contentdb(s) from any production web application, disconnect each SharePoint server from farm, create new configdb, add each SharePoint Server BACK to the farm, recreate your web applications, and connect your content databases to corresponding their web apps.

Unfortunately, there also might come a day when you do not have a proper maintenance window available and you need to resolve this without interuption to your users… Below are instructions that directly query your SharePoint ConfigDB.

Manually query your configdb to retrieve the guid of your orphaned app pool.

select *
from objects
where name is not null

Review the list that returned- under the Name column you will see you orphaned app pool along with. Pay close attention to grab the one that says “SPApplicationPool” and copy the GUID from the ID column.

<object type="Microsoft.SharePoint.Administration.SPApplicationPool, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">

Now that you have your GUID- we can get out of the DB! Lets head to one of the SharePoint Server’s in the farm and run the following STSADM command.

stsadm –o deleteconfigurationobject –id <guid>

Monday, April 5, 2010

Page Cannot Be Displayed: Add to My Links

Symptoms:

You are in a Document Library, and you find a document that you want to add to your My Links. When you click to add the document to your My Links, you suddenly are greeted with a “Page Cannot Be Displayed” error.



Resolution:

On the problem Site Collection, navigate to the top-level Site Settings page and select “Portal Site Connection”. You need to add a “/” to the end of the address listed in the Portal Web Address.

‘Link to Document’ Content Type wants me to upload?

Symptoms:

You have decided add the ‘Link to Document’ Content Type to your document library, but its asking you to upload a document and NOT to link to a document…



Resolution:

Go to your DocLib’s Settings > Link to Document Content Type > Advanced Settings > and in the “Existing Document Template” field type ‘/_layouts/NewLink.aspx’

Document in Document Library is NOT asking me to Check-Out document

Symptoms:

So you decided to click on a document to check it out for editing… Suddenly you are greeted with a “Open/Save” dialog box and not the familiar “Check out locally or on web server” message.



Resolution:

Open ‘My Computer’ >> Tools >> File Types, and scroll through the list until you find the file extension that is causing problems (.xlsx, .docx, .pptx). Once the extension is identified, select ‘Advanced’, and uncheck “Confirm after download”.

Invalid Field name. {7581e709-5d87-42e7-9fe6-698ef5e86dd3}

When you click on your Master Page in Site Settings you get the error mentioned in the title.



The FIX:

In the Site Settings -> Gallery create a new Site Content Type called "My Page Layout"
Select Parent Content Type From: Publishing Content Types
Parent Content Type: Page Layout

Now go to the Master Page Gallery.
Site Actions -> Manage Content and Structure -> Master Page Gallery

Add this newly created content type to the Master Page Gallery.
Settings -> List Settings -> Add From Existing Content Types -> Custom Content Types -> My Page Layout -> Add

This will add all the missing columns back to the Master Page Gallery. We can now safely remove the newly created content type, My Page Layout, from the Master Page Gallery.



Source: http://support.microsoft.com/kb/2000827

Which contentdb will my Site Collection be created in?

Let me begin by explaining the scenario…

You are in the process of creating a new Site Collection, and you expect this Site Collection to house around 50GB of data. You want to make sure that a content database does NOT grow past the recommended 100GB. The first place you head off to check is your existing content database status (current size and the number of current sites in the database).


Assume you have the following content databases:
Name DB Status | Current Number of Sites | Site Level Warning | Max Sites
SITES_WSS_1 Started 50 45 50
SITES_WSS_2 Started 50 45 50
SITES_WSS_3 Started 50 45 50
SITES_WSS_4 Started 35 45 50
SITES_WSS_5 Started 34 45 50

SITES_WSS_1, SITES_WSS_2, SITES_WSS_3 have all reached their current maximum growth, however- SITES_WSS_4, and SITES_WSS_5 both have room. So if we were to create a new Site Collection right now, where would it be created? SITES_WSS_5.

The reason it will be created in SITES_WSS_5 isn't because it has the least amount of current sites, but it has the MOST AVAILABLE. To determine which has the "most available" SharePoint takes the difference between the "Site Level Warning Setting", and the "Current Number of Sites"

Example:
SITES_WSS_4 has 10 spots available (45-35=10).
SITES_WSS_5 has 11 spots available(45-34=11).

The remote server returned an error: (404) Not Found.

Recently, I ran across a new error that I had never seen before.





First of all, this message is very misleading as it is returning a 404 error (which traditionally would mean that the file that you are requesting is not there or is not available), however this is NOT the case and your default.aspx page really is safe and sound. This error is very similar to pretty much any .NET error that you run into in SharePoint, and so is the resolution.



The Fix…

The fix is to simply close the misbehaving web part. You can do can accomplish this by adding "?contents=1" to the end of your web part page.

Example:

http:///default.aspx?contents=1

Deleting Site Column causes “Unknown Error” message

I ran across an issue today with a user who was received an "Unknown Error" message while trying to delete column from the site level.





This particular problem was caused by the User creating the site columns via SharePoint Designer. This problem can also happen when deploying custom features, or workflows.



THE FIX:

Go to an existing sub site (or create a temporary one if needed), and click 'Site Actions >> Site Settings >> Site Columns'. Under the Source column you will see a link to the parent site. Take note of the address of the link for each column (particularly of the case). Take note of the columns with a different case.

Open the Site Collection using SharePoint Manager 2007 and locate the columns (that you noted previously) under "Fields". Take note of what the "internal name" of the column is.





You will need to open a new browser window, and use the following URL to delete the offending columns.

http:///_layouts/fldedit.aspx?field=



Once all of the offending columns are removed, you will be able to access your Site Columns again.

"This form template is browser-compatible, but it cannot be browser-enabled on the selected site".

I was working with a user who was attempting to publish an InfoPath form to a Form Library and she was getting the following error:



This problem is similar to someone who includes code in their form ( "Tools >> Form Options >> Programming >> 'Clear Code'), however the "Clear Code" button was grayed out… After more investigation is appears that the Form Services feature was not enabled… In order to enable it at the Site Collection Level (bolded because this will enable the feature for the WHOLE Site Collection and a different feature must be called for enabling it simply for a web) you need to run the following stsadm command.



stsadm -o activatefeature -filename IPFSSiteFeatures\feature.xml -force -url http://

PPSX (PowerPoint slide show) does not open as slide show

Apparently there is a registry entry that tells your OS that if a PPTX file is opened via a hyperlink, to open it in edit mode (and NOT as a slide show). Unfortunately PowerPoint does not allow you change this setting very easily. This problem exists with non-SharePoint applications that can host PPSX files, and be accessed via a hyperlink.

Here is the KB Article on this (however it refers to the incorrect registry hive… use my instructions below):

http://support.microsoft.com/kb/299824





In order to fix this problem you will need to make a small registry change.



Click Start >> Run >> Type 'Regedit' >> and click 'OK'.

Navigate to HKEY_CLASSES_ROOT\PowerPoint.Show.12



The PowerPoint.Show.12 hive contains a entry named "BrowserFlags". Please change the value to 8.

"The specified web does not contain a reporting metadata list"

Description:

A SCA clicks on their Data Usage Summary link under Site Settings, and received the error "The specified web does not contain a reporting metadata list".



The Fix…

If you see this error, there is a problem with the reporting feature, and it must be restarted. You can either have the SCA disable/enable the feature from their Site Collection Features, or you can manually do it via stsadm. Below is the stsadm syntax:



stsadm -o deactivatefeature -name Reporting -url

stsadm -o activatefeature -name Reporting -url




and if it really is giving you a problem starting invoke a force switch…

stsadm -o activatefeature -name Reporting -url -force

Strange Access Denied Messages, and Read-Only Site Collections

I can across a strange read-only phenomenon while moving Site Collections between contentdb's last weekend. The problem is that CA will report a Site Collection as "not-locked", however STSADM reports the site as "read-only".

In my particular case the problem was caused by using the "Batch Move" option from CA, however after more investigation I found it is more prevalent than just my situation… Below is a quick description, and the fix…



Description of the problem:

Access Denied error when accessing the master page gallery, enabling or disabling publishing, syncing list and calendar information from office.
SCA's and other users are missing options that are typically available in Site Actions, and in Lists/DocLibs.


The Fix…

When in doubt turn to your trusty console abilities! Fire up STSADM and use these commands:

To return the REAL status of your Site Collection- use the following command.
stsadm –o getsitelock –url

If the previous command comes back saying that your site collection is "read-only" you will need the following command to unlock it.
stsadm –o setsitelock –url -lock none