Wednesday, November 30, 2011

Utilizing SharePoint 2010 Modal Dialogs ANYWHERE

I've noticed that I have been utilizing model dialog boxes quite a bit at a few different clients. The simple idea of navigating without actually going anywhere is awesome! No more people getting lost in breadcrumbs, no more portal connections, no more confusion.

Is this SharePoint's fault? I don't think so. I put the blame on the end User not wanting to learn 2-3 different ways to navigate through a Site Collection. The majority of End Users that I work with have no idea what a "Breadcrumb" is. What they do get is how to click on a link, and hit the "X" in the top right of a window to make it go away. So here is where I give you the solution...


Simply put the following script in a content editor web part on a page (or in your master page).


function openCreateTicketDialog(formUrl, title)
{
var options =
{
url: formUrl,
title: title,
showMaximized:true
};
SP.UI.ModalDialog.showModalDialog(options);
}




Now all you have left is to create link to call your openCreateTicketDialog function.

javascript:openCreateTicketDialog('http://www.google.com', 'ITS GOOOOOOOGLE');

I'll try to follow up to this post with the Powershell Script that lets you add these links to your sites navigation ;)

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>