Saturday, June 23, 2007

Edit Page menu item missing or disabled in the sharepoint publishing site actions menu

Situation:

After creating the master page with all the place holders, edit page menu link in the site actions menu is disabled or hidden.

Reason:

Master Page is missing the editable regions(webpart zone) or page has been checked out to another user.

Fix:
  1. Go to the 'Pages' document library, where all the publishing content pages are stored and check whether the specific page is checked out to any user. if it is checked out to any, ask that person to check in or forc the page to un do the check out. You can also check the status of the page from the Sharepoint Designer.
  2. Check whether any editable region ( webpart zone) existing on the page. If not, then open the page in sharepoint designer -> insert -> sharepoint controls -> webpart zone.
    Edit Page menu item is disabled until there is a single webpart zone availalble on the page.
  3. Check for the SP Navigation delegate control on the page. If not, then add the following lines in the master page. SP navigation delegate is the one that contains 'submit for approval' /approve/ reject buttons on the page while the page is in the edit mode.

<asp:ContentPlaceHolder ID="WSSDesignConsole" runat="server">  
<wssuc:DesignModeConsole id="IdDesignModeConsole" runat="server"/> 
</asp:ContentPlaceHolder> 
<asp:ContentPlaceHolder ID="SPNavigation" runat="server"> 
<tr>  
<td>    
<SharePoint:DelegateControl runat="server" ControlId="PublishingConsole"    PrefixHtml="
<tr>
<td colspan="4" id="mpdmconsole" class="ms-consolemptablerow">"    SuffixHtml="</td></tr>"> 
</SharePoint:DelegateControl> 
</td>  
</tr>   
</asp:ContentPlaceHolder>

Friday, June 22, 2007

System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0 in the sharepoint

Situation:

You have a custom ASP.NET code depolying to the sharepoint area. You have added the strong named assembly to the GAC (or) 80/bin. After the iisreset (or) application recycle you see the following error:

Security ExceptionDescription: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type ‘System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Reason: .NETCAS( Code Access Security) restricts the managed code at the sharepoint cost!

Fix:

Very simple than you imagined!
  1. On the sharepoint server, Go to the folder "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG"
  2. Open the config file "wss_minimaltrust.config"
  3. Under the XML section <namedpermissionsets> and under the last <permissionset> add the following:




    <IPermission class="System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    version="1"
    Unrestricted="true" >
    </IPermission>
  4. You are all set. (No iisreset/app pool recycle is needed)

Monday, June 18, 2007

Sharepoint BDC search application Full Crawl error

Whenever you write a BDC search application, you follow the steps below:

  1. Write an XML application that searches using a query on one of the properties in the entity by using the "specific Finder" method against the backend database metadata specified in the XML.
  2. SSP -> Import Application Definition -> Browse -> Import.
  3. Ignore the warning message "Profile page creation skipped". It says, its not on a specific single user find and can not create a profile link in the results.
  4. SSP -> Search settings -> Content sources and crawl schedules -> New content source -> Type the name -> Select Business Data from the types of contents available -> Crawl selected app -> select your app

Now, you get the error, when you click on the "start Full Crawl" menu option from the BDC Content source just added.

Reason: There is a problem with your authentications Your current authentication doesn not have the ability to control the search service. Sharepoint Security doesnot allow Your authintications.

Incremental crawl does not work some times, if your applicaiton doesnt include the 'column' that stores the history of the crawl, that tells when was the last time the BDC crawled.

Fix:

  1. SSP -> Search settings -> Default content access account -> Enter the Id and passwrd.
  2. SSP -> Business Data Catalog -> View Applications -> Click on the Application name -> Manage Permissions -> New User -> add the same user id and pwd that you mentioned in the step1.
  3. Click on the 'Copy all permissions to descendants.( This will give permissions on the main entity and all the entities within the entiry)
  4. Sharepoint Central Admin Home page -> Operations -> Services on server -> Office Sharepoint Server Search -> Farm Seach Service Account -> Configurable -> Enter the same ID and pwd that you entered in the step1 and 2.
  5. Wait for 1 minute, as the cache will take 1 minute to load the XML metadata into the BDC object.
  6. SSP -> Serch settings -> scopes -> select the BDC scope -> start full crawl.
  7. Click on the 'refresh' until you see the 'Idle' value.

How to test the query performance and analyze

  1. This is only to test the query running or not.
  2. Go to SQL server and start the profiler to check the queries status.
  3. Start Full Crawl on the BDC scope.
  4. After you clicked on the 'Full Crawl' , you will see the queries started running in the Profiler.
  5. If you do not get the queries running, you can click on the 'View Crawl Log' or Open the sharepoint logs(12 hive\logs) to see whats wrong!

Monday, June 11, 2007

The workflow failed to start due to an internal error in sharepoint 2007.

This error is due to the workflow features messed up in the site/site collection level.
WF will be messed up due to various reasons, lets walk through the reasons and fixes.

Scenario:
I personally experienced this error, while trying to instantiate a saved template(.stp) at the site collection level (STSADM -o addtemplate).
The Site colelction from where I created the source.stp was never activated with the workflow features. Now, when I added this site collection template while creating the site collection(destination site collection) from the SCA, This destination site collection was still provisioning to the source template's features. Thus caused the error.

The other reason is due to the 'collaboration' template. When you select 'collaboration' template and try to go for the workflows you get the above error. Coz, by default, publishing through the collaboration template is prohibited.

Other reason is the security restrictions on the Infopath Form. To fix this follow the 5th point in the fix.

Fix:
  1. First of all see whether the supported workflow features( Office SharePoint Server Standard Site features - and - Routing workflow features ) are activated in the site collection level or nor.
  2. In the destination site, where the error caused, De activate the workflow related features and re activate. (Site Actions -> Site Settings -> Site Collection Features)
  3. If you can not see the workflow features in the site collection/site level, these fatures might have got scope = "farm". and Hidden = 'True'. If so, then delete the workflow eatures and add them from the STSADM command.
  4. Once you are done with the above steps, remove the workflow from the list/lib and configure it again to start over.
  5. Still no luck, time to re install the Windows Workflow foundation.
    Lodctr c:\Windows\Microsoft.Net\Framework\v3.0\Windows WorkflowFoundation\perfcounters.ini

    The reason for above WF reload is, some times the WF will be bugged while rebuilding the performance counters on the Sharepoint Server.
  6. In the case of infopath forms, increase the trust level to 'Full Trust'.

Sunday, June 3, 2007

Enable ASP.NET dubugging for sharepoint in web.config

By default, ASP.NET debugger mode is off. To turn on do the following:

  1. Log on to the application server that you want to on the debugging
  2. reach the web.config of the web application(C:\Intetpub\wwwroot\wss\virtual folders\80\web.config) . If your application is other than 80, you need to go to that folder.
  3. Replace the below node values:



<SafeMode MaxControls="200" CallStack="false" ...>
<!-- Replace this line with-->
<SafeMode MaxControls="200" CallStack="true" ...>

<customErrors mode="On" />
<!-- Replace this line with -->
<customErrors mode="Off" />

<compilation batch="false" debug="false">
<!-- Replace this line with -->
<compilation batch="true" debug="true">
If you get have the minimal trust level, you will get the following error: Unable to read the security policy file for trust level 'WSS_Medium'
Make the following change:
<!--<trust level="WSS_Minimal" originUrl="" />-->
<trust level="Full" originUrl="" />


Saturday, June 2, 2007

hosting two sites at the root of a sharepoit web application

how to co-host traditional "team" and personal Site Collections (My Sites) within an individual Web Application in Microsoft Office SharePoint Server 2007. While possible, there are several important steps that you should be aware of.

The public profile page is a document specific to the SPSMSITEHOST site template (My Site Host); unless a My Site Host is defined in the server farm, public profile pages will not be available to users.

A Web Application can have only one (1) root Site Collection, and as a result can host only one (1) site template. In a portal specific scenario, an Enterprise site template is generally applied to the root Site Collection, typically the Publishing or Collaboration portal.

To ensure the public profile page is made available to the root Site Collection, it becomes necessary to establish a web under the root Site Collection that will host the My Site Host site template.

In order to achieve this you will need to create a new web at http:/// that will host the My Site Host site template containing person.aspx.

Person.aspx is hosted in the %commonprogramfiles%\Microsoft Shared\Web Server Extensions\12\TEMPLATE\SiteTemplates\SPSMSITEHOST directory.

There are several considerations that apply to this scenario:

· The SPSMSITEHOST template must be applied to the web hosting the public profile page.

· The web hosting the My Site Host site template cannot use an existing managed path, e.g. /personal or /sites.

· The Shared Services Provider (SSP) should be configured to use the root Site Collection + My Site Host web as the My Site Host.

This can be configured under Shared Services Administration User Profiles and My Sites My Site settings Personal Site Services.

· The root web application should have the managed path /personal defined in Central Administration to maintain URL differentiation between traditional "team" and personal Site Collections.

This process will permit continuation of the typical SharePoint Portal Server 2003 configuration and Site Collection hosting model with one key difference:
· Personal Site Collections will be available to users through http:///.
· Public profile pages will be rendered to users through http:///?person.aspx?guid=.
The example scenario below illustrates a database migration approach upgrade where a root web application is selected as both the traditional "team" and personal Site Collection host:
Step 1 Upgrade the _SITE database using the database migration approach. See command line reference below:
STSADM -o -addcontentdb -url http:// -databaserver -databasename _SITE
Step 2 Upgrade the database hosting the personal site collections using the database migration approach. See command line reference below:
STSADM -o -addcontentdb -url http:///personal databaserver -databasename
Step 3 Create a new web under the root Web Application (http://) using the My Site Host template. See command line reference below:
STSADM -o createweb -url http:///public -template SPSMSITEHOST -title "Home" -description "Some Description"
Step 4 Introduce the managed path /personal to the root Web Application if it does not already exist.
Step 5 Upgrade the _PROF database using the database migration method. See command line reference below:
STSADM -o restoressp -title -url http:// -ssplogin -mysiteurl http:///public -indexserver -indexlocation "D:\Program Files\Microsoft Office Servers\12.0\Data\Office Server\Applications" -keepindex -sspdatabaseserver -sspdatabasename -ssppassword
This process is beneficial to the database migration upgrade approach in scenarios where you are upgrading the SharePoint Portal Server 2003 _SITE, profile and content databases or optionally select to establish a new SSP in your server farm. If selecting to establish a new SSP; the root web application can be created prior to creating the SSP allowing for the establishment of the new root Site Collection as the My Site Host during the SSP creation.

"Result: 404 File Not Found" while clicking the mysite or my profile in the sharepoint or people search.Person.aspx?guid=



Problem Grounds for the my site not creation error:


mysite typical URL will be http://webappname/__layouts/mysite.aspx

this URL will be used to form the my site URL for the first time. mysite.aspx page will try to create a my site at the URL: http://webappname/personal/userid/default.aspx. Remember, 'Personal' word in the above URL is reserved. If you try to play with the name, you will get error. eg, Admin will go to SCA-> application management -> managed paths and delete the 'personal' managed path.

Fix

Always remember, never delete the 'personal' wild card inclusion. This 'personal' is always of type 'wild card' inclusion. Coz, all the profiles are going to be included under this managed path. As you already know that if any managed path is going to include so many site collections, you need go for a 'wild card' managed path.


As long as the 'personal' wild card managed path is available, the url http://webappname/__layouts/mysite.aspx will always work and produce a my site.

Now we got the my site and fine with that. But, when you try to click on the 'my profile' link, you will get 404 error.


Problem Grounds for the my profile click redirecting to 404 page:

success scenario:
Lets start by analysing the successful deployed my site's 'my profile' tab button link URL :
http://webappname/Person.aspx?accountname=domain\username


In the above case, My Site Host was deployed to the root site(http://webappname/).
This is the reason why an aspx page (Person.aspx) is able to include and be browsable directly within the root.
My site settings(SCA -> SSP -> my site settings) shows the following config:

If there is a site existing at the root site not with the 'my site host' template, problem will arise.
Administrator has to plan for the 'my site host' site at the root site always.
    So, following are the possible reasons.

  • There is a site created with a non 'my site' template(i.e team/publishing) at the root site.

  • There is no personel site provider specified in the SSP - > mysite settings.

  • SCA Admin created a my site host at http://servername:1234, but changed the personal site provider URL in the SSP -> mysite settings.
    i.e, yo Admin changed the path of Personal Site Services from http://ServerName:1234/ to http://ServerName:80.
    The site collection to which he moved the personal site provider, already has a site template(team/publish) applied to it.


  • Any of the above scenarios, if a user connects to a My Site personal site that the user created in Microsoft Office SharePoint Server 2007 and even though my site is created success fully , user will get displayed with the 404 error when clicking on the my profile link. Even the people serach scope will fail so. Coz, when you select 'people' from the scope and type the people name, possible matching users are displayed in the search results. Now, if you see the navigation link by clicking on the user name, it will be pointed to http://webappname/Person.aspx?guid=some number123445tyuuii776565
Work around:

Check whether any team site/publishing site exists at the 'http://sitename/' location.
If there is no site, then create a my site host. If there is a team/publishing site existing, then follow the below procedure.

All we need to get is the URL structures,
  1. http://webappname/personal/userid/default.aspx.
  2. http://webappname/ExclusiveManagedPath/Person.aspx?guid=some number123445tyuuii776565
As long as you have a wild card managed path named 'personal' , and if you have mentioned 'personal' in the 'Location' text box in the my site settings(SSA -> serach setings) you are fine with the first URL.

To achieve the second URL, follow the below procedure:
  1. create an exclusive managed path
    SCA -> application management -> define managed paths -> type a name (e.g. mypath) -> select "exclusive" in the inclusion. Click OK.

  2. SCA -> application management -> create site collection -> select the web application you want -> select the managed path that you created in the step1(eg. mypath) -> select the 'enterprise' tab and select the

  1. Under Shared Services Administration, click Shared Service Provider (SSP).


  2. On the home page, click My Site settings under User Profiles and My Sites.


  3. On the My Site settings page, type the URL of the included path in the Personal site provider box in the Personal Site Services area.
    Configure the options that you want for the other settings, and then click OK.


Note: If you have amy mysites already built, then you need to move the locations by stsadm command.
STSADM.exe -o backup & STSADM.exe -o restore



Possible Errors:



Error: "There has been an error creating the personal site" message:



Reason: The account that the My Site applicaiton pool is running under doesn't need any special Windows permissions. But it will need the dbcreator role in SQL Server.

Fix: So, change the identity of the my site application pool to an account that has the dbcreator role.

Sharepoint Search - Can't see "All Sites" or "People" from the drop down list when search

Change the results display page

Site Settings -> site collection settings -> search settings
  1. The second radio button option "Do not use custom scopes. Display results in the search results page (/_layouts/osssearchresults.aspx)." is meant for the "This site" entry in the drop down.
  2. The forst radio button option "Use custom scopes. Display richer results using the following Search Center:" is meant for custom drop down items like "people" and "All sites" options.
  3. To select this option, you need to have a "search center" team site. this team site will be created automatically if you have enterprise sharepoint edition, if you do not have enterprise version, create a search center site. ( site actions -> Create -> website -> Enterprise tab -> search center with tabs)
  4. Once you get the site, get the URL copied and pasted into the "Do not use custom scopes. Display results in the search results page (/_layouts/osssearchresults.aspx)." option text box.