Author Archive

TIP: Report Server "User cannot be found" error Fix

August 26th, 2008

When a SharePoint site is restored from a box on one domain to another, the users from
the old domain get carried over to the new domain, even though the new machine does not know
these users from the previous domain.

When Report Server is involved, sometimes, this can result in an error as follows:

Report Server has encountered a SharePoint error. (rsSharePointError) Get Online Help

  • User cannot be found.

The solution (copied from TechNet forums – and which worked for us a couple of times as well is as follows:

  1. Open SQL Profiler and set up a trace on the target SharePoint Content DB (you can set a filter for DatabaseName)
  2. Start SQL Profiler trace.
  3. Open the ReportServer Site in a browser.
  4. Go back to the SQL Profiler Trace. You should see, somewhere, a string which looks like the following
    proc_SecGetPrincipalById <GUID>,<INT_1>,<INT_2>,<INT_3>

    where:
    <GUID> of your Sharepoint site.
    <INT_1> user id in UserInfo table that cannot be found and has to be "really" deleted

  5. Run  the following SQL against the SharePoint Content DB in question:
    SELECT * FROM UserInfo WHERE tp_SiteID = <GUID> AND tp_ID = <INT_1>
  6. If tp_Deleted = 1 you can set it to 0 with an UPDATE command:
    UPDATE UserInfo SET tp_Deleted = 0 where TP_Id = <INT_1> AND tp_SiteID = <GUID>
  7. If the error persists, repeat steps 3 through 6 as there may be more than one old user carried across

TIP – How to rename a SharePoint Server machine name.

July 15th, 2008
When you change the machine name of a Sharepoint server in the wrong manner, Sharepoint gets very unhappy and becomes non-functional.  The following steps are some I have used to get Sharepoint back on-line with the new server name.  It can probably be streamlined as well – this is a decent starting point in my opinion.
 
Best Option
Assumes you can rename SharePoint BEFORE renaming the server. 
  • rename the SharePoint server using STSADM. (-o renameserver)
  • rename the machine to match
  • reboot
  • users / logins will refer to old machine name.  You can't change the account, so add the equivalent users back and set permissions.  When I added the new one, it wired into the old name and updated that users info instead of actually adding New.
  • In SCA (SharePoint Central Administration) update administrators where necessary.

Typical Option

Since site admins will often rename the server without checking with anyone, you have a bigger problem.  Some or all of the following may be necessary.

  • Servers renamed after SharePoint was installed will mean that SP probably won't even come up.
  • Run STSADM using: 
    Stsadm.exe -o renameserver -oldservername <oldServerName> -newservername <newServerName>
    (STSADM should have run ok, but SP will still not be happy.)
  • Now fix the Alternate Access Mappings (AAM) for the site in Central Administration with STSADM:
  • You should be now able to get into CA to finish fixing the AAMs and correct the zone (setting the new name as default instead of extranet).  Messed up site AAMs will prevent you from being able to log in.
  • Once in SCA and update all admin and secondary admin logins to make sure they are all referring to the new box. 
  • Next bring up the root SP site.  Should work ok now.
  • The Index server may not be running, so start it.  Give it a while and search.  If you get results, you're ok.
  • Check pages in site and nagivation links at top with / refs using default.aspx and not explicitly typing in the default.aspx page name.  If these work, the AAMs are good.
  • In the site, you may need to fix the logins that refer to the old machine name. 
  • SharePoint should be working again and you should be done. 


Notes courtesy of D. Vineyard @ CSC, Fort Worth, Texas

TIP: Creation of Lists with Hidden Columns via code:

February 28th, 2008

Just thought I would share a tip that I found on the usenet group: microsoft.public.sharepoint.windowsservices.development
and in particular a post made by Colin Byrne colinb@>flexnetconsult.co.uk

I am summarizing the tip below in brief with thanks to Colin for the very useful information:
nbsp;
——————-
Question: How does one create a list field that is hidden from users, but can be accessed for use in WorkFlows, etc?
Answer:Apparently, the hidden property of a list field (SPField) cannot be changed because it is blocked by the internal property CanToggleHidden being false. You can't adjust this though the public object model.
There are two work arounds, via code.

1. Add the field as XML

list.Fields.AddFieldAsXml("<Field DisplayName="NewField5"
Type="Boolean" Required="FALSE" Name="NewField5"
CanToggleHidden="TRUE" Hidden="TRUE"/>");

2. Set the internal CanToggleHidden property via reflection

string id=list.Fields.Add("NewField5",SPFieldType.Boolean,false);
SPField spfield=(SPField)list.Fields.GetField(id);

Type type = spfield.GetType();
MethodInfo mi= type.GetMethod("SetFieldBoolValue",
BindingFlags.NonPublic | BindingFlags.Instance);
mi.Invoke(spfield,new object[]{"CanToggleHidden", true});

spfield.Hidden=true;
spfield.Update();

TIP: Using code blocks in master pages throws error

June 28th, 2007

If you want to use script tags for dynamic content (asp.net code blocks) in a master page, for example:

 <%= DateTime.Now %>

and you receive the following error:

MasterPage Code Block Error

MasterPage Code Block Error

Include the following in your web.config file to resolve this issue:

Fix for Code Block error message

Fix for Code Block error message

The AllowServerSideScript attribute is, apparently, set to false by default. Setting this to true will fix the issue mentioned.

Hope this helps,
Rajiv

SSRS in SharePoint 2007 site using Forms Based Authentication (SharePoint Integrated Mode)

June 21st, 2007

This is just a post to inform all the people out there who may be struggling to implement Sql Server Reporting Services 2005 (SSRS) in a SharePoint 2007 site using Forms Based Authentication (FBA), when configured in the new SharePoint Integrated Mode (SP2).

 After months of trying to get this working and dealing with Microsoft and getting bounced back between the Sql and the SharePoint teams, we finally have an admission that this is a Microsoft bug on the SQL side. Believe me guys, this is not an easy thing to come by…

So, for the people who have been struggling on this issue like us, we suggest simply waiting for a while, as there is nothing you can really do about this currently. Microsoft has informed us that this is targeted for a Sql Server SP3, although they do not have a date for the SP3 release. In the meantime, we are targeting them to give us a hotfix that will hopefully get us over this major hurdle.

Here's a portion of  the actual e-mail we got from MS (dated June 04, 2007)


Hi Michael, Rajiv –

After further research and consultation within my team, it turns out that this issue is related to a BUG in SQL Server 2005 reporting services and is currently scheduled to be fixed in the SQL Server 2005 Sp3. And at this point we don't have any date for SQL Server 2005 Sp3.

If the issue is urgent and important for you and you would like to have a hotfix/QFE before the release of the service pack, please let me know. The final decision on whether a hotfix request will be accepted comes from our escalation team and product team – but if I clearly understand the `business Impact' of this issue for you, I can convey your request to our Escalation and Product Team.

…… rest edited …


Just wanted to get the word out to the SharePoint community. I am not sure if we will get  the hotfix for our business use yet, but will update this item on any progress.

Perhaps if the SharePoint community complains a lot, this will get more exposure in Microsoft?

 – Rajiv

 

===================

Update as of June 25, 2007:

Microsoft has reported they have been able to reproduce this issue with FBA identities not working with SSRS in a local environment, and have fully understood the source of  the issue. It turns out that a piece of code they have "wipes out" the forms identity cookie that is correctly being passed from SharePoint to the SQL engine, and therefore returns a "user not found" message, which then throws an exception within SharePoint.

They have started working on a fix for this currently, and will be promoting it to the public in the next cumulative build, release date still TBD.

(Good news for us though, is that we have been promised to be part of a test team for a "private build", to ensure this bug has been resolved to our satisfaction and won't have to wait for the SP3 release. Fantastic news!)

 More updates as we get them.

- RC

===================

Update as of July 16, 2007: 

MS gave us a "hotfix" (along with 6 other priority customers, they say – who probably reported the issue with SSRS and FBA like us) on  July 12, 2007. A couple of things to note here:

  i) The hotfix is for the file "SharePointRS.msi" (new file size: 37,458KB), which is a replacement for the SSRS Add-In for SharePoint 2007.
  ii) When I specifically asked the MS rep for which file(s) within it were new, he told me that the only replacement was for : "Microsoft.ReportingServices.SharePoint.UI.WebParts.dll"

 In any case, I had the opportunity to test this new hotfix this morning and the following are my findings:

 i) The install can simply be made over the older Add-In install without un-installing. Seems to go smoothly. I would ensure, however, that all the web.configs on the web Server do have write-access.

 ii) Though the MS rep claimed that the "Microsoft.ReportingServices.SharePoint.UI.WebParts.dll" was replaced, it seems as if the version on the dll was not updated, since  the web.config still pointed to the version prior to the hotfix.
        <SafeControl Assembly="Microsoft.ReportingServices.SharePoint.UI.WebParts, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.ReportingServices.SharePoint.UI.WebParts" TypeName="*" Safe="True" />

I thought this was interesting.

 —
It turns out that the SSRS reports can only be deployed to a DEFAULT zone (not any extended zone in a SharePoint app). So I had to flip my Authentication Provider for my default zone in my SharePoint Application to my custom FBA provider, and was able to deploy the SSRS reports from the BI Studio 2005 (after getting a prompt for FBA credentials).

The reports deployed without issues, and I was able to pull them up in the FBA zone of my SharePoint application, which is great news. Do note, however, that if you have extended zones, reports will still only be accessible through the DEFAULT zone. This has not been addressed with this hotfix.


For all the other people out there trying to resolve this issue, the MS rep mentioned to me that this hotfix will be part of a "cumulative update" to SQL Server 2005, that will be released in August 2007, and you will not have to wait for a release of SP3! Also, according to the rep I talked with, all of the initial testers of the hotfixes (including us) have not reported any major issues with the fix issued.

I hope that this brings some closure to all those who have encountered a similar issue with SSRS and FBA.

Thanks,
Rajiv

===================

TIP: Easily get to the WebPart Maintenance page for any Sharepoint Site Url

February 8th, 2007

Often times, developers in WSS3.0/MOSS2007 probably run across the issue where a web part is dropped on to a page
and then Sharepoint errors out for one reason or the other. Sometimes, the user is directed to a Web Part Maintenance page,
which helps the developer remove the offending web part from the page.

However, there is no way to get to this page from any easily available link.

Resolution:

 In order to get to the Web Part Maintenance page for ANY sharepoint url, try the following trick.

a) Append the querystring ?contents=1 to the url in the browser as shown below.

WPM_QueryString

b) The Web Part Maintenance page for the desired url can then be accessed, as seen here:

Web part page Maintenance after adding ?contents=1

Web part page Maintenance after adding ?contents=1

Symptom:

This tip can also be found at: http://weblogs.asp.net/wkriebel/archive/2004/04/12/111776.aspx,
but is repeated here, since I think this can save a lot of developers some time.

Hope this helps other developers.

- Rajiv

HOW-TO: Microsoft Office Developer Center

January 30th, 2007

I just ran across the link for the  Microsoft Office Developer Center, which boasts small how-to videos and links to common development/deployment tasks.

This seems like a place that will prove useful to many WSS3.0/MOSS2007 developers in general. I thought it would be a good idea to share with as many developers as possible, to spread the knowledge around

- Nathan and Rajiv

TIP: DLL in GAC, but cannot be accessed through Sharepoint site ("Could not load type") ? Try this fix…

December 29th, 2006

We ran into a strange issue recently. We had deployed a signed DLL to the Global Assembly Cache (GAC), and assumed
that it would be available to all applications on  the web server.

For some reason, it turned out that one of these DLLs in the GAC was not being resolved by our SharePoint application
unless the dll was copied into the in folder of the application as well.

Error when Dll is only in GAC

Error when Dll is only in GAC

Symptom:

The above shows the error that the Sharepoint Application was throwing if the DLL was in the GAC only, but not copied over to the \bin folder of the IIS virtual.

Resolution:

After some research, we determined that we had to add a line to the web.config of our SharePoint web application,
as follows:

Fix to read GAC dll files in WSS3.0

Fix to read GAC dll files in WSS3.0

The copy of the DLL could then be removed from the \bin folder leaving only the one copy in the GAC.

Hope this helps other developers.

- Rajiv

PDF IFilter Working with WSS 3.0 RTM – with proper highlighting, too.

November 29th, 2006

If you need PDF files in your search results, the steps listed by Stan Spotts in his post WSS 3.0BetaTR PDF search configuration and setup have been confirmed to work under WSS 3.0 RTM.

As an added bonus, WSS 3.0 RTM will actually show lines that contain your search term and highlight the term!

S.S. Ahmed has a detailed article that specifically for MOSS, but it is useful as well, especially for the instructions on getting the PDF icon to display: /ssa/archive/2006/10/13/13812.aspx.

Nathan

Clean B2TR removal and RTM install for Office 2007 and WSS

November 29th, 2006

Want to uninstall, then perform a clean installation of Office 2007 and WSS B2TR?  Think you can get away with running SharePoint.exe and have a perfectly working WSS?  Not so fast… After a wasted day of failed installs, a broken WSS Search Indexer, bluescreens, and yelling, we offer these tips to keep in mind when migrating, as well as our step-by-step process for a clean reinstallation.

Tips for installing:

  • If you want WSS Search to work, you need the .NET v3 Framework RTM installed
  • If you can't install the .NET v3 Framework on Windows 2003 Server or you get a "cryptographic services" error, try running regedit and set HKEY_LOCAL_MACHINE SOFTWARE Policies Microsoft   SystemCertificates TrustedPublisher Safer to 0.  The Sharepoint Configuration Wizard likes to set it back to 2.
  • If you are running Sonic RecordNow to burn your ISOs, make sure you remove it from your startup or uninstall it, or you'll get a neverending bluescreen loop at startup!
  • To remove startup items, I highly recommend Mike Lin's Startup Control Panel, found here: http://www.mlin.net/StartupCPL.shtml.
  • Even after a WSS reinstall, it is possible for Web Applications to persist which will raise an error if you try to recreate the application.  Be sure you delete them in Central Admin -> Application Management -> Delete Web Application.

Steps for B2TR to RTM migration for Office 2007 and WSS 3.0:

  1. Uninstall all Office 2007 applications, including Sharepoint Designer via Control Panel -> Add/Remove programs
  2. Uninstall WSS B2TR via Control Panel -> Add/Remove programs.
  3. Delete all Content Databases from your SQL server
  4. Ensure the SAFER key in your registry is set to 0  (see tip above)
  5. Install Office 2007
  6. Install SharePoint Designer 2007
  7. Install Visio 2007
  8. Install Project 2007
  9. Ensure the SAFER key in your registry is set to 0  (see tip above)
  10. Remove .NET Framework v3 via Control Panel -> Add/Remove programs
  11. Run the Microsoft .NET Framework 3.0 Uninstall Tool to clean up any other .NET Framework remnants.  Click YES or OK if you get any warnings during the uninstall- all the files you are being warned about (MSXML 6 for example) will be replaced when you install the latest .NET Framework.
  12. Ensure the SAFER key in your registry is set to 0 (see tip above)
  13. Install the .NET Framework 3.0 Redistributable (available at http://www.microsoft.com/downloads/details.aspx?FamilyId=10CC340B-F857-4A14-83F5-25634C3BF043&displaylang=en).
  14. Update the SAFER key in your registry (see tip above)

Hope this saves you some headaches.

Nathan