Friday, December 23, 2011

SP2010 - Cannot create new site collections


Scenario: I was not able to provision a new project web access instance on a Project Server 2010 / SharePoint 2010 environment. Further troubleshooting this problem I realized that no new site collections could be created on the environment under the specific problematic web application only. Below is the error from ULS:

Failed to provision site [project web access instance name] with error: System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.SharePoint.Administration.SPContentDatabaseCollection.FindBestContentDatabaseForSiteCreation(IEnumerable`1 contentDatabases, Guid siteIdToAvoid, Guid webIdToAvoid, SPContentDatabase database, SPContentDatabase databaseTheSiteWillBeDeletedFrom)

Solution:

This is a case of at least 1 orphaned database associated to the problematic web application. 

1. Run below powershell command to get GUID of web application.
get-spwebapplication | ? {$_.displayname -eq "Problematic Web Application Name"} | fl

2. Run this SQL query against configuration database.
select ID, Name, CAST (properties as xml) from Objects where ID = 'GUID of webapp from Step 1'

3. The results returned from step 2 will have 1 column with the properties as xml. Click on the results and it should open a new window in SQL Mgmt studio with xml output.

4. Search for the word "m_Databases" in the xml output.

5. Carefully read through the tag that stores the above searched word. You should be able to see fld tags. Find out a tag which has fld tag with value null. This is the orphan database. Its GUID is the xml line above where you found null.

6. Cross verify all databases currently associated with the web application and make sure this database is not getting used.

7. Run below powershell script,
$webapp.contentdatabases.delete(‘ID-of-bad-content-db’) 
This script will throw an object reference error. Do not worry, it works its magic under the hood.

Try to create a new site collection now and it should work. 

Summary: The above problem occurs because if there one entry which has fld value set to null SharePoint thinks that that database is the most suitable one to create new site collections in. But since it is an orphaned database, it is unable to do so and reports the above error in ULS which is repeated every time a new site collection creation request is initiated with through SP user interface or Project Server interface.

Windows RDP ALT problem

When you open a new RDP session from a Windows machine sometimes the keyboard does not work correctly. 
For e.g.
Once the RDP session has started and you have logged in successfully, when you press the T button it switches between taskbar windows rather than simply typing the letter T. It looks like it performs the same function as ALT + T although ALT is not pressed.


Solution:
Within the RDP session presss the ALT button several times.

Monday, December 19, 2011

SP2010 Doc icon does not link to document

Scenario:
Site which are migrated from SP2007 to SP2010 have lost the automatic link of doc icon, i.e. pdf, word, excel etc to the document. Users have implemented list view webpart where they used this functionality for one click opening of documents from any page.


Solution:
Microsoft has recognized this as a bug and provided a fix.
http://support.microsoft.com/default.aspx?scid=kb;en-US;2457975

SP2010 list view toolbar

If you want the SP2007 toolbar, with New, Upload, Actions and Setting buttons, edit the list view page and edit the list view webpart. Set the toolbar type dropdown to "Show Toolbar" option.


Reference: http://www.glynblogs.com/2011/02/displaying-the-list-toolbar-in-sharepoint-2010.html

SP2010 document check out issue

Scenario:
Users are not able to check out documents from document libraries. The error is returned is the message,
"The document cannot be checked out as it is already checked out to another user."


Solution:
Make sure the web application where the document library is hosted has a root site collection created.

Monday, December 12, 2011

Upload SP2007 list templates to SP2010

Solution:
  1. Rename the original .STP to .CAB
  2. Extract its manifest.xml and other contents (if any) to a local folder (lets call it [folder])
  3. Search for the ProductVersion element. This should have a value of 3
  4. Change its value to 4
  5. Repackage the manifest.xml into a .CAB. I've done this by using makecab.exe in the C:\Windows\System32 folder
    Syntax
    : makecab.exe [folder]\manifest.xml [folder]\{template-name}.cab
  6. Change the generated cabinet's extension from .CAB back to .STP and upload it into the _catalogs/lt

Sunday, December 11, 2011

Mount-SPContentDatabase Powershell bug

Scenario:
Mount-SPContentdatabase command fails with "object reference not set to an instance of an object" error.
At first these errors are only shown for Basic Meeting Workspace.


Solution:
Make sure you are not running "Mount-SPContentdatabase" command for the same database using the same powershell window. If yes, close the window and open a new SharePoint 2010 powershell window and continue the operation.




References:
http://www.ekhichdi.com/b/Object-reference-not-set-to-an-instance-of-an-object-upgrade-sharepoint-416.html


http://blogs.msdn.com/b/jorman/archive/2010/06/09/mount-spcontentdatabase-failing-on-blank-meeting-workspace.aspx

Thursday, December 8, 2011

SP2010 Missing - "Alert Me"

If outgoing email is not configured for a SP 2010 environment then the "Alert Me" button will not be displayed on the ribbon.

SP2010 Table of Contents Webpart Limit 20


Fix:
1. Navigate to subsite where the issue exists. 
2. Click Site Actions -> Site Settings
3. Click Navigation
4. Set a higher value greater than 20 for Current Navigation.
5. Save and close.

SP2010 ListView Ribbon missing

Scenario:
Post upgrade to SP2010 from SP2007 the ribbon is missing on some list view pages (allitems.aspx).


Solution:
This happens if there is a CEWP or any other webpart or any modifications done to the default list pages like allitems.aspx. Once the pages are modified SP treats them as application pages and hence the ribbon is modified.


You will notice that clicking on the list view webpart on the page will bring the ribbon back or clicking on one the item checkboxes.


You can add some JS to a CEWP to fix this problem as mentioned in the reference below. The JS simply sets focus to the list view webpart once the page has loaded.


Reference:
http://stackoverflow.com/questions/4848892/list-tools-tab-is-no-longer-available-after-adding-webpart-to-the-page 

Wednesday, December 7, 2011

SPDeletedSite Cmdlets

SPDeletedSite commandlets only work if you have deleted the site collection via the browser ui or the object model.  If you are an admin and you have explicitly called Remove-SPSite, then your site collection is not available to the SPDeleteSite commandlets. 


Reference:
http://www.bluedoglimited.com/SharePointThoughts/Lists/Posts/Post.aspx?List=c54e62cf-53d4-4cae-b91f-2bc78ecb9def&ID=334&Web=6ec2c35a-a7b4-42a9-9b1f-96f0e83c9a99

Tuesday, December 6, 2011

SP2010 - Send link in email

Problem:
Send link in email option is missing in SP2010 which was available in SP2007.


Workaround:
With IE (Not Chrome, not sure about firefox) you can hold down CTRL and click the title - this then opens up the edit form with ID?=XXX (i.e. no dialog) in a new window - then easy to copy and paste into email.


Reference:
http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/8aaa788a-9d99-40b2-bf5f-37955d870f75

Monday, December 5, 2011

SP2010 - CallStack CustomError

Problem:
Although you have set callstack=true, customerrors=Off and compilation=debug in web.config of your web application, you still do not get the stack trace. 


Solution:
Set customerrors=Off here,
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\web.config 


Reference:
http://stackoverflow.com/questions/3616652/how-can-i-see-the-exception-call-stack-in-sharepoint-2010

Friday, December 2, 2011

STSADM ' - ' Command line error



Scenario:
All parameters passed to stsadm command are correct but it still complains about "Command line error". This is an encoding issue.


Solution:
e.g. If this command does not work on cmd prompt,
       stsadm -o enumsites -url http://myurl -databasename dbname
      - Paste this command in a notepad and try to search for -databasename 
      - Notepad will return "cannot find -databasename " although you can see it there.
The '-' is not getting encoded correctly. Simply delete the - and retype it in notepad. Copy and paste it in cmd prompt and execute. It will work. This problem may occur with any '-' parameter.




Reference:
http://weblogs.asp.net/soever/archive/2007/12/22/sharepoint-stsadm-exe-and-the-infamous-quot-command-line-error-quot.aspx

Powershell - Non CLS compliant type


Error:
The field/property: "Id" for type: "Microsoft.SharePoint.Administration.SPContentDatabase" differs only in case from the field/property: "ID". Failed to use non CLS compliant type.
Solution:
The way that you have to work around this issue is to get a handle to the type’s property using reflection and then invoke the SetValue() method.
$maxProp = [Microsoft.SharePoint.Administration.SPContentDatabase].GetProperty("MaximumSiteCount")
$maxProp.SetValue($siteCol.ContentDatabase, 1, $null)
If you want to get the property value:
$returnVal = $maxProp.GetValue($siteCol.ContentDatabase, $null)

Reference : 

Wednesday, November 30, 2011

SP2010 Alert Nightmares

Scenario: Existing alerts on SP2007 sites upgraded to SP2010 after changing web application host name stop working.

Solution: This post from Shane is the solution,
http://msmvps.com/blogs/shane/archive/2011/08/22/after-sharepoint-2010-database-attach-upgrade-alerts-have-the-wrong-urls.aspx

Remeber to first run the powershell script from technet,
http://technet.microsoft.com/en-us/library/cc508847.aspx 
and then use the script provided above by Shane to fix the issues from MS script.

After running the script from technet check the [SiteUrl] column in the [ImmedSubscriptions] table in the content database where your site collection resides to make sure it points to the right host web application host name. If it does not then the alerts are simply not triggered. Also make sure the Outgoing email settings are enabled.

Even after configuring all the above sometimes alert emails are not sent for new and SP2007 migrated alerts. Here are some more steps to troubleshoot.
1. Find the database which stores the site collection data.
2. Run "select * from timerlock" against that database
3. Get the GUID of the Server (LockedBy column) who is supposed to execute all timer job activities for this site collection.
4. To map the GUID to user friendly server name run the following powershell,
Get-SPServer | Foreach-Object { Write-Host $_.id $_.Name}
5. Make sure this server is allowed to relay emails in your network.


Some of the points to check if alerts are working on some site collections but not on others,
 - Outgoing email settings on web application
 - Allow smtp relay from all servers(where SPTimerv4 is Started) in your farm.


Other references:
http://blogs.msdn.com/b/skelley/archive/2007/06/18/alerts.aspx
http://support.microsoft.com/kb/936759

http://www.rightpoint.com/community/blogs/viewpoint/archive/2010/08/26/the-truth-about-how-daily-sharepoint-alerts-actually-work.aspx

http://www.moss2007.be/blogs/vandest/archive/2007/12/27/sharepoint-immediate-alert-notifications-stopped-working.aspx

http://sharepointalert.info/2009/11/troubleshooting-sharepoint-alerts-timer-jobs/

http://blogs.technet.com/b/harikumh/archive/2008/05/25/troubleshooting-alerts.aspx

http://blogs.technet.com/b/steve_chen/archive/2009/11/20/alerts-in-sharepoint-troubleshooting-moss-wss.aspx

http://sharepointalert.info/

http://sunilrepale.wordpress.com/

Friday, November 25, 2011

Business Connectivity Services

An external content type is really a reusable description of external data to allow it to participate as a native Office entity across multiple applications such as:
  • SharePoint as external list
  • Outlook
  • SharePoint workspace
  • Word
  • InfoPath
  • Access
  • Other Office applications via code
 http://msdn.microsoft.com/en-us/magazine/ee819133.aspx

Wednesday, November 23, 2011

People Picker: "There was an error in the callback"


This was my issue although I had stsadm setapppassword and peoplepicker-searchadforests setup correctly.

***
On the “HKLM\Software\Microsoft\Shared Tools\Web Server Extensions\14.0\Secure” registry key ensure the following permissions are in place and are being inherited in the sub-keys


* WSS_WPG Read permission


* WSS_Admin_WPG Full Control


* WSS_RESTRICTED_WPG_V4 Full Control





Reference:
http://blogs.msdn.com/b/sofocle/archive/2011/05/17/sharepoint-2010-people-picker-issue-quot-there-was-an-error-in-the-callback-quot.aspx

Tuesday, November 22, 2011

Override Redirect Help link SharePoint 2010

Override help link on SharePoint 2010.

Excellent article.
http://blakeblackshear.wordpress.com/2009/04/25/adding-a-custom-help-url-to-sharepoint-the-right-way/ 

JS snippet:

var intervalId = setInterval('OverrideHelpButton()', 250);
function OverrideHelpButton()
{
TopHelpButtonClick = function (strParam)
{
var wndHelp=window.open('/HelpFiles/index.html', 'STSHELP',
'height=500,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=475'
 );
wndHelp.focus();
}
}
setTimeout('window.clearInterval(intervalId);', 10000);

Monday, November 14, 2011

Exception from HRESULT: 0x80040E14

Scenario:

Users get this exeception when they try to add new content to SharePoint 2007 sites.

Solution:

If the transaction log for the configuration database is full this error can occur for random number of sites in the farm.

Tuesday, November 1, 2011

Project Server 2010 - Waiting for resources

Scenario: Trying to provision new project server 2010 pwa instance. The status is stuck at "Waiting for resources" After some time checking the ULS logs and the content database statistics we releaize that a new site collection did get created.

Solution: Make sure that the SharePoint 2010 Timer service is "Started" on all servers where it is supposed to run.



Monday, October 24, 2011

SharePoint Server - Antivirus

If antivirus software is installed on SharePoint servers use below link to exclude certain folders so that search results are not quarantied.

Thursday, October 20, 2011

Test-SPContentDatabase : The content database could not be found


Error "Test-SPContentDatabase : The content database could not be found." occurs when you try to execute Test-SPContentDatabase DbName command

Solution: This happened to me when I ran this command on a SP2007 database which was not yet attached to any web application in SP2010. Use the following syntax,
Test-SPContentDatabase -Name DbName -WebApplication "Url of a SP2010 web application"

Tuesday, October 4, 2011

ADFS 2.0 / PingFederate Encryption

AD FS 2.0 Encryption Strength


In AD FS 2.0, encryption of outbound assertions is turned on by default. Assertion encryption occurs for any relying party/service provider for which AS FS 2.0 possesses an encryption certificate.

When it performs encryption, AD FS 2.0 uses 256-bit Advanced Encryption Standard (AES) keys, or AES-256. In contrast, by default PingFederate supports a weaker algorithm (AES-128). Failing to reconcile these conflicting defaults can result in failed SSO attempts.Alternatives for addressing this issue include the following:

• Disabling encryption in AD FS 2.0. To disable encryption, on the AD FS 2.0 computer, click Start, click Administrative Tools, and then click Windows PowerShell Modules. Then, at the Windows PowerShell command prompt, type the following:

other

Copy

set-ADFSRelyingPartyTrust –TargetName “Ping Example” –EncryptClaims $False

• Upgrade PingFederate’s encryption capability. Because of import control restrictions, the standard Java Runtime Environment (JRE) distribution supports strong but not unlimited encryption. For this reason, the strongest cipher suites are commented out of the two configuration files com.pingidentity.crypto.SunJCEManager.xml and com.pingidentity.crypto.LunaJCEManager.xml, which are located in the folder /server/default/data/config-store. To use the strongest encryption, remove the comments from the AES 256 cipher suites, and then download and install the appropriate version of Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files from the Java SE Downloads (http://go.microsoft.com/fwlink/?LinkId=206383).

Friday, September 30, 2011

ADFS 2.0 WS-Federation

Just heard from a MS support engineer yesterday,
ADFS 2.0 does not support WS-federation as Idp-Initiated SSO. It has to be SP-Initiated SSO. However it supports SAML 2.0 in both modes.

Tuesday, September 27, 2011

SharePoint 2010 - Upgrade required

Scenario:


Installed SharePoint binaries on a new server . Ran Sharepoint configuration wizard to join server to existing farm. All goes well and no errors are reported. Admin navigates to central admin -> System settings -> Manage servers in farm. Red message that says "Upgrade required" on the recently added server.


Solution:
Execute this command on the server,

PSConfig.exe -cmd upgrade -inplace b2b -force -cmd applicationcontent -install -cmd installfeatures

Reference:
http://blog.techgalaxy.net/archives/2585


Monday, September 26, 2011

Could not find Feature DataConnectionLibrary

Scenario: Trying to export/import a subsite from a SharePoint 2007 environment with enterprise features, (e.g. Data connection library) to a farm with standard license.


Solution:


I have added my comments here,
http://social.technet.microsoft.com/forums/en-US/sharepointadmin/thread/057c53ef-3541-47ec-9152-7e6852fbd669?prof=required


Saturday, September 24, 2011

MediaTomb PS3

Scenario:
PS3 does not detect mediatomb hosted on ubuntu desktop even though we followed the manual here, https://help.ubuntu.com/community/MediaTomb


Solution:
1. Make sure mediatomb is started correctly on ubuntu. For e.g. a sample command is "mediatomb -e wlan0" to start media tomb using wireless lan network interface.


2. Browse to the url provided in terminal and share content.


3. Make sure firestarter (http://ubuntuforums.org/showthread.php?t=129911) is installed and policy is added to allow inbound traffic from PS3 IP address.


4. Open PS3, under Video -> Search for media servers.





Friday, September 23, 2011

ADFS 2.0 Debugging / Tracing

Scenario:
Environment with customized idp login pages. ADFS redirects to Error page with a reference number. The reference number is not the be see in event viewer.

Solution:

1. Which log to check ? Cannot find messages in EventViewer - Application.
Refer this link for solution: http://stackoverflow.com/questions/5147277/adfs-v2-0-finding-errors-referenced-by-the-reference-number


"Open the Event Viewer. Navigate to 'Applications and Services Logs' -> 'AD FS 2.0' -> Admin. In the 'View' menu, using 'Add/Remove Columns...', add the 'Correlation Id' column. Look up the reference number 'c14bcf7c-268d-46be-82c3-7c1d873c3df2' in the 'Correlation Id' column.


(In some specific cases you get a 'Reference number' but no event in the AD FS 2.0 event log. In my experience that is mostly when customizing the sign-in pages.)"


2. Enable tracing

Excellent article to enable tracing for ADFS 2.0

http://social.technet.microsoft.com/wiki/contents/articles/1407.aspx

Much more detailed: http://blogs.msdn.com/b/card/archive/2010/01/21/diagnostics-in-ad-fs-2-0.aspx

The steps in the above article should help configure tracing of ADFS and enable logging to event viewer. It still does not show up anything because of customized login pages.

3. Right click on Error page and check source. Nothing. Sometimes MS loves putting the stack trace in there.

4. Fiddler to the rescue:

    a. Navigate to the inetpub (inetpub\..\ad\ls\) folder where the Error.aspx page can be found.
    b. There is just one method in there, Add   "HttpContext.Current.Response.Write(Exception.ToString())"
    c. This should present the exact stack trace.
    d. Use the same idea for the pages that were edited, e.g. idp login page and trace it using Respose.Write.
    e. If it still does not work, and it still redirects to Error page and the response.write on Error page provide a very generic message, then use fiddler and read the response of each page during the transaction and you will see the error on the pages.
(Make sure to decrypt https requests using fiddler cert.)

Thursday, September 22, 2011

ADFS Idp Initiated SSO - RelayState


AD FS 2.0 does not support specifying the RelayState in the case of IdP-initiated request. (The support for RelayState is limited to echoing back in SP-initiated requests.) The relying party must identify the target resource in its configuration.



To pass RelayState in ADFS 2.0, there is a non-supported workaround which requires some custom code (for additional information, please refer to the discussions HOW CAN I SPECIFY THE TARGET URL DIRECTLY IN THE SAML REQUEST AND HAVE AD FS 2.0 AUTOMATICALLY REDIRECT?[1] and SPECIFY RELAYSTATE URL[2].


The workaround requires two critical tweaks in the Sign-In Pages:


1. Edit the Global.asx.cs file, and add, after line 22 (HttpResponse response = HttpContext.Current.Response;) the following code:
if ( !String.IsNullOrEmpty( request.Params["SAMLResponse"] )
!String.IsNullOrEmpty( request.Params["SAMLart"] ) )
{
if ( !String.IsNullOrEmpty( request.Params["RelayState"] ) )
{
HttpCookie cookie = new HttpCookie( "rs", request.Params["RelayState"] );
cookie.Expires = DateTime.UtcNow.AddMinutes( 10 );
Response.Cookies.Add( cookie );
}
}
It basically looks for SAMLResponse/SAMLart with a RelayState, and then “stuff” the RelayState in a cookie.


1. Edit the page IdpInitiatedSignOn.aspx.cs by adding after line 56 (string rpIdentity = Context.Request.QueryString [RpIdentityQueryParameter]) the following code:


HttpCookie cookie = Context.Request.Cookies.Get( "rs" );
if ( null != cookie && !String.IsNullOrEmpty( cookie.Value ) )
{
rpIdentity = cookie.Value;
cookie.Expires = DateTime.UtcNow.AddDays( -1 );
cookie.Value = "";
Context.Response.Cookies.Add( cookie );
}


//
// If the query string specified a certain relying party, sign in to that relying party.
//
if ( !String.IsNullOrEmpty( rpIdentity ) )
{
string decodedIdentity = Server.UrlDecode( rpIdentity );
if ( decodedIdentity == IdpAsRpIdentifier )
{
decodedIdentity = String.Empty;
}


//
// If app is not in list of known RPs, assume it is a WS-Federation app and redirect to it.
//


bool found = false;
foreach( DataRow row in RelyingParties.Rows )
{
if ( row[0] == rpIdentity )
{
found = true;
}
}


if ( found )
{
SignIn( rpIdentity, new SignOnRequestParameters() );
}
else
{
//
// TODO: Fill in your own trusted WS-Federation app URLs below.
//
if ( rpIdentity == "https://example.com/a_trusted_url"
rpIdentity == "https://example.org/another_trusted_url" )
{
Response.Redirect( rpIdentity );
}
}
}
It basically extracts that cookie and uses it to start an IdP initiated sign on.


Moreover, if the RelayState doesn’t map on to a known SAML 2.0-based relying party, there is a place in the code to enter a list of known WS-Federation URIs to have AD FS 2.0 redirect to.


For 90% of cases (including SharePoint 2007/2010 and, more generally, WIF 1.0-based applications), this will kick off an SP-initiated sign in and “it just works”.


Tuesday, September 20, 2011

ADFS - SAML 2.0 for Idp Initiated SSO

Scenario: My first experience setting up an ADFS environment to enable federation between ADFS and PingFederate. This is strictly Idp Initiated SSO scenario, where ADFS is the Idp.

Steps:
1. Send federation xml to relying party / SP (PingFederate user). This should include SSL certificate information and chain certificate information.
2. Receive xml from relying party
3. Extract certificate information from xml and save as .cert file. (This is done by extracting text content from relying party xml between the tags,
)
4. Store .cert file in AD or local server Trusted Root certificate store
5. Create a relying party connection in ADFS by uploading relying party xml from step 2.
6. Edit and setup claim rules, for e.g. map employee ID from AD (i.e. LDAP) to Name ID claim type.
7. Load certificate from relying party into relying party encryption configuration in ADFS.

*These steps should ideally be enough to setup the federation. The client needs to have his application point to Idp ADFS. The Url would look something like this,

https://adfs-server-hostheader/adfs/ls/idpinitiatedsignon.aspx?LoginToRP=RPIdentityName
where RPIdentityName is the name of the Relying Party Identifier name.

Troubleshooting tips:
1. Many a time security is an issue. Hence we need to run some powershell scripts to disable encryption.
e.g. Set-ADFSRelyingPartyTrust

2. Use Fiddler to track SAML traffic, http://msinnovations.wordpress.com/2011/05/24/using-fiddler-to-trace-a-saml-idp-request-from-adfs-2-0/

Critical Issue:

Reference http://technet.microsoft.com/en-us/library/adfs2-federation-with-ping-identity-ping-federate(WS.10).aspx

"AD FS 2.0 does not support the declaration of a Target or RelayState parameter when it acts as the IdP during IdP-initiated SSO. Therefore, successful use of the third link (IdP-initiated SSO)—which does not state the target application explicitly—requires the SP to use the Default URL feature in PingFederate (which is already configured in this lab). The setting is available on the Main Menu under My SP Configuration\Application Integration Settings\Default URLs."

In our situation, the relying party had PingFederate and had a dummy url as its default url which was causing issues during federation.

Solution: (Read right to the end) ADFS and RelayState issues
http://social.msdn.microsoft.com/Forums/en/Geneva/thread/91812934-e620-44c7-b4ef-8383083dc3c4

http://syrstad.blogspot.com/2011/02/adfs-saml-and-relaystate.html
 

http://mydailytechlog.blogspot.com/2011/09/adfs-idp-initiated-sso-relaystate.html


Update (9/23/2011):

None of the above code options worked for us since our RelyingParty is PingFederate.

This final solution which should work in this scenario is to a SP-Initiated SSO as mentioned in this link,
http://social.msdn.microsoft.com/Forums/ar-SA/Geneva/thread/dbd703a1-d6ce-4376-ac49-9d7e1809c9f3 
and confimed by MSFT here,
http://social.msdn.microsoft.com/Forums/en/Geneva/thread/91812934-e620-44c7-b4ef-8383083dc3c4


Visual Studio 2010 Ultimate - Performance Testing

Scenario: Installed Visual Studio 2010 Ultimate and Visual Studio Agents 2010 to prepare a Load test environment for web performance testing. Installed controller and agent and configured them. Open Visual Studio 2010 Ultimate and navigated to Test -> Manage Controllers. Next to Controller you get the message "Local No Controller".

Solution:
Type the FQDN of the current machine and hit enter.

Monday, September 19, 2011

Site Collection Deleted - Get Database Name

Scenario: Site collection admin deletes root web from a site collection, thereby deleting the entire site collection. Now they want it restored. If you have clearly documented mapping between site collection and content db (assuming you have large number of content db's) you can easily restore the content db and get the site collection restored.


Solution: For all those who do not have it documented. SharePoint config db has a table called "SiteMap" which store site collection to database mapping.


1. Do a SQL backup/restore of SharePoint config database from a time before the deletion occurred. (Remember this is just a SQL restore not SharePoint)


2. Check the dbo.SiteMap table for database information.

Friday, September 16, 2011

IIS Blank - Cannot find sites

Scenario:
When you open IIS Server Manager to browse SharePoint web sites you get a blank screen. When you try to connect to local host, you get the message, "Path specified cannot be used at this time"

Solution:
Stop SharePoint Timer service
Stop WWW Publishing service
Stop SMTP service
Stop HTTP SSL service
Stop IIS Admin service

Start all of the above in the same order.

Permanent fix: http://support.microsoft.com/kb/946517 

Tuesday, September 13, 2011

Request for security token failed


Error:
Request for security token failed with exception: System.ServiceModel.FaultException: The server was unable to process the request due to an internal error.

Environment:
Microsoft Project Server 2010
Microsoft SharePoint Server 2010

Solution:
1. Start "Claims to Windows Token Service " on all servers in the farm.
2. IISRESET on all servers.


Prevent person.aspx redirect from userdisp.aspx

Scenario:
A SharePoint environment is newly built with its dedicated domain controller (DC) and has migrated content from another SP environment with a seperate DC. The migrated content has existing users which needs to be migrated to the new domain. Used stsadm -o migrateuser command to achieve the same. When user clicks on the new converted user name in the site collection user groups page, the user is now redirected to person.aspx rather than userdisp.aspx

Solution:
This behaviour is expected because,
a. MySite feature is enabled on the farm which embedds a redirectcontrol in the userdispform.aspx page which causes the redirect.
b. The user has a profile in SSP.

We uninstalled the Mysite feature from farm features using stsadm. Remember it is a hidden feature.

Friday, September 9, 2011

Windows Server RDP cannot see local drives

Scenario:
After RDP to a Windows Server, you cannot find your local drives mapped on the remote server. This is annoying especially if you want to copy files over to the server.

Solution:
http://technet.microsoft.com/en-us/library/cc757353(WS.10).aspx#BKMK_TSC  

Wednesday, September 7, 2011

Find Windows Server last reboot

Scenario: I need to find out when was the last time one of our Windows server rebooted.

Solution:
1. Open command prompt
2. type "net statistics server"
3. It will display statistics from the last reboot time.

Tuesday, August 30, 2011

Project Server 2010 - PWA Creation Failed

Scenario:
When trying to provision a new PWA. It fails on Provisioning Databases stage. Event
viewer records the below errors,

Microsoft.Office.Project.Server.Administration.ProvisionException: Failed to provision databases. ---> Microsoft.Office.Project.Server.Administration.ProvisionException: IF NOT EXISTS (SELECT name FROM sysusers WHERE name = N'ProjectServerRole' and issqlrole = 1)
BEGIN
EXEC sp_addrole N'ProjectServerRole', N'dbo'
END
---> System.Data.SqlClient.SqlException: User does not have permission to perform this action.


Root cause: The farm account used to execute the PWA creation command does not have sysadmin privileges on the database instance.

Solution: In our environment no account is allowed sysadmin privileges, although it is clearly mentioned as a requirement for Project Server 2010, http://technet.microsoft.com/en-us/library/cc197607.aspx
We have decided to grant the farm account db_owner permissions manually on each of the 4 pwa databases and then Retry the provision process.

Sunday, August 28, 2011

SP2010 Workflow Events

Scenario:

Start a new workflow based on completion of a different workflow.

Solution:

Use SPWorkflowEventReceiver class


- WorkflowStarting - A workflow is starting
- WorkflowSterted - A workflow was started
- WorkflowPostponed - A workflow was postponed - WorkflowCompleted - A workflow was completed

Friday, August 26, 2011

SP2010 Activity Feed / News Feed


News feeds are populated using a job in Central Administration -> Monitoring -> Review job definitions -
> [User Profile Service Application] - Activity Feed Job

Tuesday, August 23, 2011

Exam 70-573


This is just an incredible resource to study for Exam 70-573.

SharePoint 2007 Site Template list does not exist

Scenario:
User creates a site template in a publishing site collection (using the old trick of navigating directly to save site as template page). This site template includes CEWP's which point to static images as placeholders. When a new site is created using the template, everything works fine except,
a. Site Settings -> Modify Navigation results in "List not found" error
b. Edit CEWP and try to change the placeholder image to a valid image -> List not found error

Solution:
Navigate to Site Settings -> Modify Navigation
Error occurs
REFRESH page !

All the CEWP's start working. I have not yet identified the root cause of this issue. Reflector should be able to help. My feeling is that the publishing infrastructure adds some link pointers in the site template as GUIDs which cannot be found after the new site is created using the template.

UPDATE: This could be a possible explanation,
http://mossipqueen.wordpress.com/2008/08/08/assetportalbrowser-error-list-does-not-exist/

Monday, August 22, 2011

SharePoint SSL

Scenario:
Setup SSL for existing HTTP SharePoint web site.

Details:
1. SelfSSL, Entrust -> assign certificate
2. If only SSL is required, then drop current IIS website ONLY
3. If multiple websites require SSL on same server, use multiple IPs
4. Alternate access mappings:
Zone: default
Internal:
https -> https
http -> https
5. Also note F5 is used to offload SSL.
6. Once SSL is configured setup required AAM's and re-configure search settings.

Sunday, August 21, 2011

Connect Ubuntu and PS3

Scenario:
Need to use ubuntu machine as a media server for PS3.

Solution:
Use mediatomb

Steps:
1. This link explains almost all steps in detail,
https://help.ubuntu.com/community/MediaTomb

Issues:
1. Media Tomb icon is not displayed in PS3 under videos, music or pictures.
Ans: Restart media server (computer) and PS3.

2. Media Tomb icon is displayed but only PC directory is shown although you have shared appropriate folder from computer and mediatomb is working.
Ans: Restart PS3


Thursday, August 18, 2011

SharePoint .NET SAML

Want to use .net to create SAML token ?

Refer these links,
http://developers.de/blogs/damir_dobric/archive/2007/02/22/Creating-of-SAML-token.aspx

http://msdn.microsoft.com/en-us/library/system.identitymodel.tokens.samlassertion.aspx

Tuesday, August 16, 2011

SP2010 - Difference between v2v and b2b

Difference between v2v and b2b,
•A v2v upgrade is used for upgrading from one product version to another (e.g. MOSS 2007 to SharePoint Server 2010).
•A b2b upgrade is used for upgrading from one build to another within the same product version (e.g. SP2010 RTM to SP2010 SP1).

Sunday, August 14, 2011

Hide ribbon from annonymous users - SP 2010

Use this link info to hide ribbon effectively from annonymous users. It also resolves the scrollbar issue,
http://www.portalsolutions.net/Blog/Lists/Posts/Post.aspx?ID=91

If you want authenticated users to see the ribbon then you have multiple options,
1. Move the "welcome user" to another location on the page.
2. Provide a new link that points to /_layouts/authenticate.aspx which will open up IE login window.

Tuesday, August 9, 2011

SharePoint 2010 SP1 and June CU

1. Logon, as the setup account to perform all the operations
2. Run the SharePoint configuration Wizard to check that everything is OK in the Farm
3. Checked the existence of an up to date Full SharePoint Farm backup, if not take one now, before the update, just in case something goes wrong.
4. Took a full SharePoint Farm backup using Central administration
5. Installed the SharePoint Foundation SP1 package (sharepointfoundation2010sp1-kb2460058-x64-fullfile-en-us.exe)
6. Rebooted server (as requested by previous installation)
7. Installed the SharePoint Office Server SP1 package (officeandprojectserver2010sp1-kb2460047-x64-fullfile-en-us.exe)
8. Rebooted server (as requested by previous installation)
9. Installed the SharePoint Foundation June CU package (sharepointfoundation2010-kb2536601-fullfile-x64-glb.exe)
10. Rebooted server (as requested by previous installation)
11. Installed the SharePoint Office Server June CU package (office2010-kb2536600-fullfile-x64-glb.exe)
12. Run the SharePoint 2010 Products Configuration wizard on central admin server

References:
http://support.microsoft.com/kb/2532120
http://support.microsoft.com/kb/2536600
http://support.microsoft.com/kb/2536601

Thursday, July 28, 2011

Open a utf8 encoded file saved in windows on unix or linux

Scenario:
Programmatic creation of xml files using c# in a sharepoint library. These files are then manually sent over to a linux system that reads these files using bash od command. The output of the linux command sees 3 special characters in front of the xml declaration tag which is not visible when we open the file in notepad on windows.

Solution:
The 3 special characters are displayed due to BOM (Byte order marker) present as the first character in the generated xml file which is not visible in notepad. The solution is to remove the BOM character programmatically before writing the file to disk / sharepoint.

This can be easily achieved using,

Pass false as a parameter to the constructor so that it ignores the BOM while encoding files.


Wednesday, July 27, 2011

SP2010 Tag external sites.


Click on Tag this page on an internal site and read the information on the dialog box.

Tuesday, July 26, 2011

SharePoint Most Popular / Viewed Documents webpart

Ideas to build a SharePoint Most Popular Documents webpart

1. IIS Log
a. we use a logparser to push iis logs to db monthly for reporting. tweak the code to push only document read info to a db table daily.
b. build a webpart to read the sql table.
2. Audit logs (bad idea)
a. turn on site collection audit logs to track document view.
b. use audit log object model to read the info you need.
3. Site collection usage reports -> i dont know if the reports store the document information. I dont think it does, maybe worth a check.
4. Complicated approach, but could be extended,
a. Deploy a delegate control at site(any level?) level with some javascript, which will track document clicks (trust me this will be complicated) and uses ajax to store it back the server in a config list.(It could just write to a links list).
b. Use the list view webpart / custom webpart to display the list view.

Saturday, July 16, 2011

Read sharepoint xml file into memory dataset

using (MemoryStream mStr = new MemoryStream(folder.Files[0].OpenBinary()))
{
DataSetVariable.ReadXml(mStr);
}

Friday, July 15, 2011

Create SPFolder and upload SPFile programmatically

SPList list = web.GetListFromUrl(u);
SPFolder folder = web.GetFolder(string.Format("0}/{1}",list.RootFolder.Url,foldername));
if (!folder.Exists)
{
folder = list.RootFolder.SubFolders.Add(foldername);
}

using (MemoryStream stream = new MemoryStream())
{
nds.WriteXml(stream);
SPFile file = folder.Files.Add(filename, stream);
}

Thursday, July 14, 2011

Add user to email distribution list

Email distribution lists can be easily manipulated using ADSI code (System.DirectoryServices) and LDAP protocol.

ampersand .net app.config configuration files

Using & (ampersand) in .net configuration files

You cannot use the & symbol in the application configuration files (web.config and app.config). For your application to work replace the & symbol with "& amp; (without the space in between ampersand and the word amp)"

Add service reference in visual studio for password protected services

Visual Studio does not directly allow to add web reference to password protected secure webservice and it will throw error like you have mentioned. But you can still add web reference to secure webservice by using 2 techniques.

Browse the webservice wsdl in a browser. It will prompt for security login and provide the username/password. Then save the WSDL xml into a file in your local computer.
Then add web reference to this local version of wsdl. In this way, you will be able to add web reference to secure password protected webservice using visual studio.

Asp.net user-agent parse

private float getInternetExplorerVersion()
{
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
float rv = -1;
System.Web.HttpBrowserCapabilities browser = Request.Browser;
if (browser.Browser == "IE")
rv = (float)(browser.MajorVersion + browser.MinorVersion);
return rv;
}

private void Page_Load(object sender, System.EventArgs e)
{
string msg;
double ver = getInternetExplorerVersion();
if (ver > 0.0)
{
if (ver >= 7.0)
msg = "You're using a recent version of Internet Explorer.";
else
msg = "You should upgrade your copy of Internet Explorer.";
}
else
msg = "You're not using Internet Explorer.";

Label1.Text = msg;
}

Reference:
http://msdn.microsoft.com/en-us/library/ms537509%28v=vs.85%29.aspx

Monday, July 11, 2011