Scenario:
I have migrated few HTML files from MOSS Document Libraries to SP2010 Document Libraries. On click of these HTML files , I am getting a download file prompt.
In MOSS , there is no such issue. Click HTML file renders the file.
Reason:
SP2010 has restrictions on displaying or opening some files. This was not the case in MOSS 2007.
Solutions:
Revisit HTML files and try converting them to ASPX pages. This is highly recommended.
OR
From Central administration > Web Application General Settings > Check the "Browser File Handling" to "Permissive" for that web application. This does open some holes. Recommended only in intranet type scenario's.
Article:
Understand permissive option
Wednesday, January 4, 2012
Tuesday, May 3, 2011
Scenario:
We plan to use Report Viewer control in SharePoint for some reporting needs.
Solution:
It was a small challenge to make it work with SharePoint. Here's my experience ( error / resolutions )
Error 1 : The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file. Add <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> to the system.web/httpHandlers section of the web.config file.
Error was self explanatory. I was suppose to register new HTTPHandler to my web.config. Here's how it will look like after adding it.
<httpHandlers>I refreshed the screen and got
<remove verb="GET,HEAD,POST" path="*" />
<add verb="GET,HEAD,POST" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add verb="OPTIONS,PROPFIND,PUT,LOCK,UNLOCK,MOVE,COPY,GETLIB,PROPPATCH,MKCOL,DELETE,(GETSOURCE),(HEADSOURCE),(POSTSOURCE)" path="*" type="Microsoft.SharePoint.ApplicationRuntime.SPHttpHandler, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpHandlers>
Error 2 : The type 'Microsoft.SharePoint.Portal.Analytics.UI.ReportViewerMessages, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' does not implement IReportViewerMessages
This was tricky but with some google helped me. I noticed 'ReportViewerMessages' under AppSettings. I removed it and error was gone.
I refreshed the screen and got
Error 3: Session state is disabled in web.config for SharePoint. The Report Viewer control requires that session state be enabled in local mode.
This was able straight forward. I enabledSessionState = true.
<pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" asyncTimeout="7">Small update for SP2010
My good friend Clayton tried this on SP2010 but still got error related to session state not enable.
Running following command helped him.
Enable-SPSessionStateService –DefaultProvisionOne more thing > Don't make these changes to web.config directly but go for something which we have done. We have used a custom application page in layouts to host all the reports. Also we created a local web.config there and updated all these settings in there to reduce the impact to least.
Thursday, February 24, 2011
Scenario:
Client me a old MOSS VM for development purpose and as the project is related to Profiles, I logged on to the Main portal site and clicked on My Site link on the top.
Error 1 : File not Found
Solution:
If you notice , Sharepoint is saying that there is no such site. So that means we need to create one before we proceed further.
Steps :
1. Go to Central Administration
2. Click on Application Management
3. Under "SharePoint Web Application Management" , click on Define managed path.
4, Make sure to select right Web Application where you want My Site ( In my case http://ws2003 ) from the drop down menu
5. Add a new Managed Path 'mysite' with 'Explicit inclusion'
6. Click on Application Management again on the topnav
7. Click on Create a new Site Collection
8. Create a new site collection at 'http://ws2003/mysite' using 'My Site Host' site template
Cool.. we solved Error 1 :)
So I clicked the My Site link on the top again and got
Error 2 : Your personal site cannot be created because Self-Service Site Creation is not enabled. Contact your site administrator for more information.
Solution:
If you notice , SharePoint is saying that some setting is missing and need to be enabled.
1. Go to Central Administration
2. Click on Application Management
3. Under ' Application security' section click on 'Self-service Site Management' link
4. Set the radio button to 'On'
Cool.. we solved Error 2 :)
So I clicked the My Site link on the top again and got
Error 3 : Your personal site cannot be created because the managed path "personal" has not been created for this site. Contact your site administrator for more information.
Explaination:
SharePoint is saying that my site tried creating a site for the logged in user but couldn't because the managed path 'personal' is not defined, under which it was suppose to create all the personal sites.
There are 2 ways to solve the issue.
Solution 1:
Use a managed path which is already defined in the web application settings , i.e. sites. Here's the steps to do this
1. Go to Central Administration
2. Click on the SSP Site from the left menu
3. Click on My Site Settings link under 'User Profile settings'
4. Replace the value in 3rd textbox from 'personal' to 'sites'
Solution 2:
Create a new managed path 'personal'
1. Go to Central Administration
2. Click on Application Management
3. Under "SharePoint Web Application Management" , click on Define managed path.
4, Make sure to select right Web Application where you want My Site ( In my case http://ws2003 ) from the drop down menu
5. Add a new Managed Path 'personal' with 'Wildcard inclusion'.
Cool.. all errors gone. Click on My Site to get to your personal site collection
Monday, December 6, 2010
Scenario:
Provider model was one of the best enhancement we saw in ASP.Net 2.0 and SharePoint is kinda designed to used to best of dot net framework so that end user / developer waste less time to create something quickly.
CurrentNavigation is the default provider when you create a web application.
In my experience GlobalNavigation, CurrentNavigation and SPXmlContentMapProvider providers are most commonly used.
Here's list of all the providers available in SP2010 with description.
Code:
<siteMap defaultProvider="CurrentNavigation" enabled="true">
<providers>
<add name="SPNavigationProvider" type="Microsoft.SharePoint.Navigation.SPNavigationProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="SPSiteMapProvider" type="Microsoft.SharePoint.Navigation.SPSiteMapProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="SPContentMapProvider" type="Microsoft.SharePoint.Navigation.SPContentMapProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="SPXmlContentMapProvider" siteMapFile="_app_bin/layouts.sitemap" type="Microsoft.SharePoint.Navigation.SPXmlContentMapProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="ExtendedSearchXmlContentMapProvider" description="Provider for navigation in Extended Search pages" siteMapFile="_app_bin/layouts.sitemap" type="Microsoft.Office.Server.Search.Extended.Administration.Common.ExtendedSearchXmlContentMapProvider, Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="AdministrationQuickLaunchProvider" description="QuickLaunch navigation provider for the central administration site" type="Microsoft.Office.Server.Web.AdministrationQuickLaunchProvider, Microsoft.Office.Server.UI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="SharedServicesQuickLaunchProvider" description="QuickLaunch navigation provider for shared services administration sites" type="Microsoft.Office.Server.Web.SharedServicesQuickLaunchProvider, Microsoft.Office.Server.UI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="PWASiteMapProvider" description="Project Web App provider for global navigation" type="Microsoft.Office.Project.PWA.PWASiteMapProvider, Microsoft.Office.Project.Server.PWA, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" mode="Quick Launch" securityTrimmingEnabled="true" initializeMetadata="true" />
<add name="GlobalNavSiteMapProvider" description="CMS provider for Global navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Global" EncodeOutput="true" />
<add name="CombinedNavSiteMapProvider" description="CMS provider for Combined navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Combined" EncodeOutput="true" />
<add name="CurrentNavSiteMapProvider" description="CMS provider for Current navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Current" EncodeOutput="true" />
<add name="CurrentNavSiteMapProviderNoEncode" description="CMS provider for Current navigation, no encoding of output" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Current" EncodeOutput="false" />
<add name="GlobalNavigation" description="Provider for MOSS Global Navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Combined" Version="14" />
<add name="CurrentNavigation" description="Provider for MOSS Current Navigation" type="Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider, Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" NavigationType="Current" Version="14" />
<add name="SiteDirectoryCategoryProvider" description="Site Directory category provider" type="Microsoft.SharePoint.Portal.WebControls.SiteDirectoryCategoryProvider, Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="MySiteMapProvider" description="MySite provider that returns areas and based on the current user context" type="Microsoft.SharePoint.Portal.MySiteMapProvider, Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="MySiteLeftNavProvider" description="MySite Left Nav provider that returns areas and based on the current user context" type="Microsoft.SharePoint.Portal.MySiteLeftNavProvider, Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="MySiteSubNavProvider" description="MySite Sub Nav provider that returns areas and based on the current user context" type="Microsoft.SharePoint.Portal.MySiteSubNavProvider, Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</providers>
</siteMap>
Saturday, December 4, 2010
Scenario:
Here's a quick list of noise keywords in search
Please note this file is editable and you can go to Index server and add some more if required
Tuesday, October 26, 2010
Scenario:
I am working with a BCS Model and it is not picking up the change.
Solution:
While cache-ing is great for enterprise applications but sometime I hate it , specially during development , where we want to see the change with zero lag. Anyway I don't think so that's gonna happen. So we developers have our own tricks / steps to deal with it
Steps to Refresh BCS Model:
Assuming you are deploying using WSP package.
01. Retracted exisiting solution i.e. "myModel.wsp"
02. Navigate to BCS Service application and Deleted Model from everywhere
03. IISReset
04. Restarted "SharePoint Server Search 14" service
05. Deployed the new solution i.e. "myModel.wsp"
06. Navigate to BCS Service Application and add object permissions for your model
07. ( Optional ) Create/Upgrade the profile pages
08. Navigate to "Search Service Application" and re-crawl fully the Content Source using your Model
09. Once finished , Check the error log.
10. If all went smooth then checked the crawled properties, they should be there
Friday, July 9, 2010
Scenario:
Already I am a big fan of Powershell. I thought of setting my solution using Power shell on a new machine.Script just worked great.
Let me share few of the them which we all use often.
Code:
###########################################################################################
# Create a new WebApplication
###########################################################################################
$newWebApplicationUrl = "http://intranet.contoso.com"###########################################################################################
$ApplicationPoolAccount = Get-SPManagedAccount "contoso\Administrator"
New-SPWebApplication -Name "CustomApplication" -ApplicationPool "CustomApplication-80" -ApplicationPoolAccount $ApplicationPoolAccount -Port 80 –Url $newWebApplicationUrl
#Enabled Claim Based authentication for Existing Web Application:
###########################################################################################
$webApplicationUrl = "http://intranet.contoso.com"###########################################################################################
$webapp= Get-SPWebApplication $webApplicationUrl
$webapp.UseClaimsAuthentication
$webapp.UseClaimsAuthentication=$True
$webapp.Update()
$webapp.ProvisionGlobally()
iisreset
# Add new managed path for Projects Site Collections:
###########################################################################################
$webApplicationUrl = "http://intranet.contoso.com"###########################################################################################
New-SPManagedPath –RelativeURL "/ProjectCentral" -WebApplication $webApplicationUrl -Explicit
New-SPManagedPath –RelativeURL "/Projects" -WebApplication $webApplicationUrl
# To add/deploy custom solutions in central administration.
###########################################################################################
Add-SPSolution -LiteralPath CustomApplication.wsp###########################################################################################
Install-SPSolution -Identity CustomApplication.wsp –AllWebApplications –GACDeployment
# To create a site collection:
###########################################################################################
$projectCentralUrl = "http://intranet.contoso.com"###########################################################################################
$siteTitle="Project Central";
$owner="contoso\administrator"
$template=”STS#0”
$newSiteColl = New-SPSite $projectCentralUrl –Name $siteTitle –OwnerAlias $owner –Template $template
$newSiteColl.Dispose()
# Enable publishing infrastructure features
###########################################################################################
Enable-SPFeature -Identity PublishingSite -url $projectCentralUrl###########################################################################################
Enable-SPFeature -Identity PublishingWeb -url $projectCentralUrl
# Enable Performance Point feature at Site Collection level
###########################################################################################
Enable-SPFeature -Identity PPSSiteCollectionMaster -url $projectCentralUrl###############################################################################################
# To create a subsite for TeamManagement under Project Central with unique permissions:
###############################################################################################
$webTeamManagement = New-SPWeb –Name "Team Management" –Url "$projectCentralUrl/TeamManagement" -Template "STS#1" –UniquePermissions####################################################################################################
#Owners group creation ( Assuming Client Authentication Enabled )
$owner = $webTeamManagement.AllUsers["i:0#.w|contoso\administrator"]
$ownerGroupName ="$webTeamManagement Owners"
$webTeamManagement.SiteGroups.Add($ownerGroupName,$owner,$owner,$ownerGroupName)
$ownerGrp = $webTeamManagement.SiteGroups[$ownerGroupName]
$webTeamManagement.AssociatedOwnerGroup = $ownerGrp
$ownerRole="Full Control"
$ownerAssignment = New-Object Microsoft.SharePoint.SPRoleAssignment($ownerGrp)
$ownerRoleDefinition=$webTeamManagement.RoleDefinitions[$ownerRole]
$ownerAssignment.RoleDefinitionBindings.Add($ownerRoleDefinition)
$webTeamManagement.RoleAssignments.Add($ownerAssignment);
#Members group creation ( Assuming Client Authentication Enabled )
$member = $webTeamManagement.AllUsers["i:0#.w|contoso\administrator"]
$memberGroupName ="$webTeamManagement Members"
$webTeamManagement.SiteGroups.Add($memberGroupName,$member,$member,$memberGroupName)
$memberGrp = $webTeamManagement.SiteGroups[$memberGroupName]
$webTeamManagement.AssociatedMemberGroup = $memberGrp
$memberRole="Contribute"
$memberAssignment = New-Object Microsoft.SharePoint.SPRoleAssignment($memberGrp)
$memberRoleDefinition=$webTeamManagement.RoleDefinitions[$memberRole]
$memberAssignment.RoleDefinitionBindings.Add($memberRoleDefinition)
$webTeamManagement.RoleAssignments.Add($memberAssignment);
#Visitors group creation ( Assuming Client Authentication Enabled )
$visitor = $webTeamManagement.AllUsers["i:0#.w|contoso\administrator"]
$visitorGroupName ="$webTeamManagement Visitors"
$webTeamManagement.SiteGroups.Add($visitorGroupName,$visitor,$visitor,$visitorGroupName)
$visitorGrp = $webTeamManagement.SiteGroups[$visitorGroupName]
$webTeamManagement.AssociatedVisitorGroup = $visitorGrp
$visitorRole="Read"
$visitorAssignment = New-Object Microsoft.SharePoint.SPRoleAssignment($visitorGrp)
$visitorRoleDefinition=$webTeamManagement.RoleDefinitions[$visitorRole]
$visitorAssignment.RoleDefinitionBindings.Add($visitorRoleDefinition)
$webTeamManagement.RoleAssignments.Add($visitorAssignment);
$webTeamManagement.Update()
$webTeamManagement.Dispose()
# To create a subsite for Report Center under Project Management with unique permissions:
####################################################################################################
$webReportCenter = New-SPWeb –Name "Report Center" –Url "$projectCentralUrl/BI" -Template "BICENTERSITE#0" –UniquePermissions####################################################################################################
#Owners group creation
$owner = $webReportCenter.AllUsers["i:0#.w|contoso\administrator"]
$ownerGroupName ="$webReportCenter Owners"
$webReportCenter.SiteGroups.Add($ownerGroupName,$owner,$owner,$ownerGroupName)
$ownerGrp = $webReportCenter.SiteGroups[$ownerGroupName]
$webReportCenter.AssociatedOwnerGroup = $ownerGrp
$ownerRole="Full Control"
$ownerAssignment = New-Object Microsoft.SharePoint.SPRoleAssignment($ownerGrp)
$ownerRoleDefinition=$webReportCenter.RoleDefinitions[$ownerRole]
$ownerAssignment.RoleDefinitionBindings.Add($ownerRoleDefinition)
$webReportCenter.RoleAssignments.Add($ownerAssignment);
#Members group creation
$member = $webReportCenter.AllUsers["i:0#.w|contoso\administrator"]
$memberGroupName ="$webReportCenter Members"
$webReportCenter.SiteGroups.Add($memberGroupName,$member,$member,$memberGroupName)
$memberGrp = $webReportCenter.SiteGroups[$memberGroupName]
$webReportCenter.AssociatedMemberGroup = $memberGrp
$memberRole="Contribute"
$memberAssignment = New-Object Microsoft.SharePoint.SPRoleAssignment($memberGrp)
$memberRoleDefinition=$webReportCenter.RoleDefinitions[$memberRole]
$memberAssignment.RoleDefinitionBindings.Add($memberRoleDefinition)
$webReportCenter.RoleAssignments.Add($memberAssignment);
#Visitors group creation
$visitor = $webReportCenter.AllUsers["i:0#.w|contoso\administrator"]
$visitorGroupName ="$webReportCenter Visitors"
$webReportCenter.SiteGroups.Add($visitorGroupName,$visitor,$visitor,$visitorGroupName)
$visitorGrp = $webReportCenter.SiteGroups[$visitorGroupName]
$webReportCenter.AssociatedVisitorGroup = $visitorGrp
$visitorRole="Read"
$visitorAssignment = New-Object Microsoft.SharePoint.SPRoleAssignment($visitorGrp)
$visitorRoleDefinition=$webReportCenter.RoleDefinitions[$visitorRole]
$visitorAssignment.RoleDefinitionBindings.Add($visitorRoleDefinition)
$webReportCenter.RoleAssignments.Add($visitorAssignment);
$webReportCenter.Update()
$webReportCenter.Dispose()
# To create FAST Search Center needs to activate Sharepoint Server Public Infrastructure feature:
####################################################################################################
$webSearch = New-SPWeb –Name "Search" -Url "$projectCentralUrl/Search" -Template "SRCHCENTERFAST#0"####################################################################################################
$webSearch.Dispose()
# Activate Site Collection Features & Site Features of My Workspace:
####################################################################################################
Enable-SPFeature -Identity "CustomSolution_XSLTFiles" –Url $projectCentralUrl####################################################################################################
Enable-SPFeature -Identity "CustomSolution_SavedSearchesListInstance" –Url $projectCentralUrl
Enable-SPFeature -Identity "CustomApplication_TeamManagementSiteFeature" –Url $projectCentralUrl
Enable-SPFeature -Identity "ProjectXSNForms" –Url $projectCentralUrl
# Activate Features on Project Management:
####################################################################################################
Enable-SPFeature -Identity "CustomSolution_FeatureX" –Url "$projectCentralUrl/TeamManagement"####################################################################################################
# Get new web objects for all the webs
####################################################################################################
$projectCentralUrl = "http://intranet.contoso.com"####################################################################################################
$webProjectCentral = Get-SPWeb "$projectCentralUrl"
$webTeamManagement = Get-SPWeb "$projectCentralUrl/TeamManagement"
$webReportCenter = Get-SPWeb "$projectCentralUrl/bi"
$webSearch = Get-SPWeb "$projectCentralUrl/search"
# Adjusting the master page from OOTB to CustomApplication based master pages
####################################################################################################
$webTeamManagement.Navigation.UseShared = $true############################################################################################
$pubWebProjectCentral = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($webprojectCentral)
$pubWebProjectCentral.IncludeSubsitesinNavigation=$True
$pubWebProjectCentral.CustomMasterUrl.SetValue($pubWebProjectCentral .CustomMasterUrl.Value.Replace("v4","Custom"))
$pubWebProjectCentral.MasterUrl.SetValue($pubWebProjectCentral .MasterUrl.Value.Replace("v4","Custom"))
$pubWebSearch = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($webSearch)
$pubWebSearch.CustomMasterUrl.SetValue($pubWebSearch.CustomMasterUrl.Value.Replace("minimal","CustomApplication_minimal"))
# Adjusting the search center url
###########################################################################################
$searchUrl="/Search/Pages"############################################################################################
$webProjectCentral.AllProperties["SRCH_ENH_FTR_URL"] = $searchUrl
$webProjectCentral.AllProperties["SRCH_SITE_DROPDOWN_MODE"] = "ShowDD"
# Update Web objects and dispose them
###########################################################################################
####################################################################################################
$pubWebProjectCentral.Update()
$pubWebSearch.Update()
$webProjectCentral Update()
$webTeamManagement.Update()
$webReportCenter.Update()
$webSearch.Update()
$webSearch.Dispose()
$webReportCenter.Dispose()
$webTeamManagement.Dispose()
$webProjectCentral.Dispose()
# To associate workflow to list
####################################################################################################
$projectCentralUrl = "http://intranet.contoso.com"####################################################################################################
$web = Get-SPWeb "$projectCentralUrl/TeamManagement"
$list = $web.Lists.TryGetList("Project Forms")
$workflowInstanceName = "Project Site Status"
$workflowName = "CustomApplication-New Project Site Collection WF"
$historylistguid =$web.Lists.Add("Project Workflow History","",140)
$historylist =$web.Lists[$historylistguid]
$tasklistguid =$web.Lists.Add("Project Workflow Tasks","",107)
$tasklist=$web.Lists[$tasklistguid]
$culture=new-object System.Globalization.CultureInfo("en-US")
$basetemplate = $web.WorkflowTemplates.GetTemplateByName($workflowName,$culture)
$workflowAssociation=[Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListAssociation($basetemplate,$workflowInstanceName ,$taskList,$historyList)
$workflowAssociation.AutoStartCreate = $True;
$list.WorkflowAssociations.Add($workflowAssociation)
$list.Update();
$web.Dispose()
# Create a new site collection
####################################################################################################
$ProjectSeriesID = "00001"####################################################################################################
$newSiteCollectionUrl = "http://intranet.contoso.com/Projects/$ProjectSeriesID"
$owner="contoso\administrator"
$template=Get-SPWebTemplate "CustomApplicationSiteDefinition#0"
$siteTitle=$ProjectSeriesID
$newProjectSiteCollection = New-SPSite -URL $newSiteCollectionUrl -Name $siteTitle -OwnerAlias $owner -Template $template
$newProjectSiteCollection.Dispose()
# Adding a new link to Link List
####################################################################################################
$siteCollectionUrlForSitePool = "http://intranet.contoso.com"####################################################################################################
$sitecoll=Get-SPSite $siteCollectionUrlForSitePool;
$webTeamManagement= Get-SPWeb "http://intranet.contoso.com/TeamManagement"
$List=$webTeamManagement.Lists["My Links"];
$item=$List.Items.Add()
$item["Title"]="Project Site"
$item["Site Url"]="http://intranet.contoso.com/Projects/00001"
$item.update()
$List.update()
$webTeamManagement.Dispose()
# This will switch the home page for TeamManagement with a tabbed UI
####################################################################################################
$projectCentralUrl = "http://intranet.contoso.com"####################################################################################################
$webProjectCentral = Get-SPWeb "$projectCentralUrl/TeamManagement"
$sfile = $webProjectCentral.GetFile("default.aspx")
$dfile = $webProjectCentral.GetFile("home.aspx")
$dfile.CheckOut()
$dfile.SaveBinary($sfile.OpenBinary())
$dfile.CheckIn("done using code")
$webProjectCentral.Update()
#Remove Team Management Sub Site
####################################################################################################
$projectCentralUrl = "http://intranet.contoso.com"####################################################################################################
Remove-SPWeb "$projectCentralUrl/CaseManagement"
# Remove Site Collection
####################################################################################################
$projectCentralUrl = "http://intranet.contoso.com"####################################################################################################
Remove-SPSite -Identity $projectCentralUrl -GradualDelete -Confirm:$False
#Remove WebApplication with content databases and IIS
####################################################################################################
$projectCentralUrl = "http://intranet.contoso.com"####################################################################################################
Remove-SPWebApplication $projectCentralUrl -Confirm -DeleteIISSite -RemoveContentDatabases
# Retracting and Removing CustomApplication Solution
###################################################################################################
$solutionPackageName = "CustomApplication.wsp"Article:
$solution = Get-SPSolution | where-object {$_.Name -eq $solutionPackageName}
# check to see if solution package has been installed
if ($solution -ne $null) {
if($solution.Deployed -eq $true)
{
Uninstall-SPSolution -Identity $solutionPackageName -AllWebApplications -Local -Confirm:$False
}
}
Remove-SPSolution -Identity $solutionPackageName -Confirm:$false
Search center options , Some more commands
Thursday, May 27, 2010
Scenario:
Wrote a small Silverlight application which was trying to display the title of the site using Client Object Model and to my surprise I got the following error :
{System.Security.SecurityException ---> System.Security.SecurityException: Security error.
at System.Net.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.BrowserHttpWebRequest.<>c__DisplayClass5.
at System.Net.AsyncHelper.<>c__DisplayClass2.
--- End of inner exception stack trace ---
at System.Net.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
at System.Net.WebClient.OpenReadAsyncCallback(IAsyncResult result)}
Solution:
This can be because of few reasons
1. Make sure the web URL used to create the Client context object exist and brows-able.
2. This might be because of missing client policy access file missing for the SharePoint Web Application not allowing you to connect. Create a new XML file named ClientAccessPolicy.xml with content below and save it to 'C:\inetpub\wwwroot\VirtualDirectories\80'
Note : Update policy file and port number as needed.
ClientAccessPolicy.xml:<?xml version="1.0" encoding="utf-8" ?>
Once you have the file copied to right location, do an IISReset and make sure you can access the file using following url :
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true" />
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
http://servername:portno/clientaccesspolicy.xml
Note
This setting is only for Development Environment. Read the following article how to tweak the policy file for production environment.
Article:MSDN
Friday, May 14, 2010
I got a brand new laptop and very powerful one. As its all for SharePoint, here some tips and steps I used to make it ready to ROCK
Hardware Configuration : i7 , 8 GB RAM , 320 GB HDD
OS Configuration : Window Server 2008 R2 Enterprise installed
Step by Step guide
Power
Make sure you have the power source hooked and you are not on battery backup.
Internet
Plug the hard wire for internet, we will use this to download latest hotfixes/patched and other big softwares.
Windows Update and Rebooting
Run the Windows Update and restart once all the updates are installed ( without fail )
Add Features
Desktop Experience
Ink
Quality Window Audio and Video
XPS Viewer
Windows Update and Rebooting
Run the Windows Update and restart once all the updates are installed ( without fail )
Mouse
Plug the USB mouse and make sure it get recognized
Internet Explorer
a) Configure Internet explorer startup settings using Wizard
b) By default Internet Explorer enhanced security is enabled , turn Off for Administrator.
Search for 'Server Manager' > Configure IE ES > select Off for Administrator
c) Change default search provider from BING to what ever u like
Machine Name
Rename machine to a better name before you start using it.
Activate Operating System
Activate the OS before you proceed furthur.
Add Role for Hyper V
Search for 'Server Manager' > Add Roles
Look for Hyper-V and install it
Reboot the machine to finalize the changes
Audio
Search for 'Services'
Look for Windows Audio Service - Set it to Automatic - and Start it.
Resolution
Adjust monitor's resolution so that you can utilize maximum screen space.
Time
Adjust time zone and server to reflect correct values
Drivers
Go to your laptop brand website and search for Support and Drivers
a ) Search for Wireless Drivers - Install it
Reboot the machine and Select your preferred network
b) Dual Monitor - Be careful as Hyper-V has issues with high end drivers and can crash your machine.
If you are confident install the graphic drivers
Command Line
As we will use the command window frequently , Launch cmd and set the font and adjust color to something smoother and better
Folder options
Windows Explorer > Press Alt key to get the File menu
Options > Uncheck Hide know file type ,
Softwares
Virtual PC 2007 -
Visual Studio 2010 - Lauch once and set the Keyboard layout to VB or C#
Install Office 2007/2010 ( 32 BIT please ) and Configure Outlook account
Windows Update and Rebooting
Run the Windows Update and restart once all the updates are installed ( without fail )
Communication
a ) Yahoo Messenger - Configure Alerts and Notification options to avoid surprises
b ) MSN
c) GTalk
Developer tools
Visual Studio 2010
Web Installer 2.0
Other productivity tools
Download Google Chrome - make sure to change the Download folder location
Download Firefox - make sure to change the Download folder location
Acrobat Reader
Adobe Flash
7Zip
Notepad++
Snipper Tool ( Its there actually in c:\Windows\System32 and look for Snipper Tool.exe > Right click to save a shortcut to desktop )
Tuesday, May 11, 2010
Scenario:
While working with calculated column I got the following error,
The formula refers to a column that does not exist. Check the formula for spelling mistakes or change the non-existing column to an existing column. at Microsoft.SharePoint.Library.SPRequestInternalClass.CallCalcEngine(Int32 operation, String bstrUrl, String bstrListName, String bstrString1, String bstrString2)
at Microsoft.SharePoint.Library.SPRequest.CallCalcEngine(Int32 operation, String bstrUrl, String bstrListName, String bstrString1, String bstrString2)
Here's the formula I had, which got saved without an issue
=IF([ShowLastUpdated],[Modified],)
But when I opened the same column in edit mode and tried saving it again and got the error. On closer look I found the formula is changed to
=IF(ShowLastUpdated,Modified,) where all braces were missing.
Solution:
Adding the brackets again around the columns solved the issue. This is certainly a bug.Also when i tried with a simple formula ( =Modified ) , I didn't find this issue.
Wednesday, March 24, 2010
Scenario:
I have used Content Query Webpart and everytime I learn something but this time I think I found a BUG as OOTB xslt files available with Content Query does not support Header and Footer in fully controlled manner.
Solution:
I have re-adjusted few templates to make it easier for any one to edit.Even though I am dumping here all the changed templates , you can skip all these steps by simple downloading the updated file
ContentQueryMain.xsl for 2007 <- DOWNLOAD (free)
ContentQueryMain.xsl for 2010 <- DOWNLOAD (free, please rename file to ContentQueryMain before Use)
This updated version of ContentQueryMain.xsl supports Header , GroupHeader , GroupFooter and Footer templates.
Output will be something like this :
Code:
<xsl:template name="OuterTemplate.Body">
<xsl:param name="Rows" />
<xsl:param name="FirstRow" />
<xsl:param name="LastRow" />
<xsl:variable name="BeginColumn1" select="string('<td id="column" width="')" />
<xsl:variable name="BeginColumn2" select="string('%" valign="top">')" />
<xsl:variable name="BeginColumn" select="concat($BeginColumn1, $cbq_columnwidth, $BeginColumn2)" />
<xsl:variable name="EndColumn" select="string('</td >')" />
<xsl:for-each select="$Rows">
<xsl:variable name="CurPosition" select="position()" />
<xsl:if test="($CurPosition >= $FirstRow and $CurPosition <= $LastRow)">
<xsl:variable name="StartNewGroup" select="@__begingroup = 'True'" />
<xsl:variable name="StartNewColumn" select="@__begincolumn = 'True'" />
<xsl:choose>
<xsl:when test="$cbq_isgrouping != 'True'">
<xsl:if test="$CurPosition = $FirstRow">
<xsl:value-of disable-output-escaping="yes" select="$BeginColumn" />
<!-- New call to the Header template-->
<xsl:call-template name="OuterTemplate.CallHeaderTemplate"/>
</xsl:if>
</xsl:when>
<xsl:when test="$StartNewGroup and $StartNewColumn">
<xsl:choose>
<xsl:when test="$CurPosition = $FirstRow">
<xsl:value-of disable-output-escaping="yes" select="$BeginColumn" />
<!-- New call to the Header template-->
<xsl:call-template name="OuterTemplate.CallHeaderTemplate"/>
<!-- Renamed the existing Header template to group header template -->
<xsl:call-template name="OuterTemplate.CallGroupHeaderTemplate"/>
</xsl:when>
<xsl:otherwise>
<!-- Renamed the existing Footer template to group footer template -->
<xsl:call-template name="OuterTemplate.CallGroupFooterTemplate"/>
<!-- New call to the Footer template-->
<xsl:call-template name="OuterTemplate.CallFooterTemplate"/>
<xsl:value-of disable-output-escaping="yes" select="concat($EndColumn, $BeginColumn)" />
<xsl:call-template name="OuterTemplate.CallHeaderTemplate"/>
<!-- Renamed the existing Header template to group header template -->
<xsl:call-template name="OuterTemplate.CallGroupHeaderTemplate"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$StartNewGroup">
<!-- Renamed the existing Footer template to group footer template -->
<xsl:call-template name="OuterTemplate.CallGroupFooterTemplate"/>
<!-- Renamed the existing Header template to group header template -->
<xsl:call-template name="OuterTemplate.CallGroupHeaderTemplate"/>
</xsl:when>
<xsl:when test="$StartNewColumn">
<xsl:choose>
<xsl:when test="$CurPosition = $FirstRow">
<xsl:value-of disable-output-escaping="yes" select="$BeginColumn" />
<!-- New call to the Header template-->
<xsl:call-template name="OuterTemplate.CallHeaderTemplate"/>
</xsl:when>
<xsl:otherwise>
<!-- New call to the Footer template-->
<xsl:call-template name="OuterTemplate.CallFooterTemplate"/>
<xsl:value-of disable-output-escaping="yes" select="concat($EndColumn, $BeginColumn)" />
<xsl:call-template name="OuterTemplate.CallHeaderTemplate"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="OuterTemplate.CallItemTemplate">
<xsl:with-param name="CurPosition" select="$CurPosition" />
</xsl:call-template>
<xsl:if test="$CurPosition = $LastRow">
<!-- Added an additional check to render the group footer only if grouping is enabled : start -->
<xsl:if test ="$cbq_isgrouping = 'True'" >
<!-- Renamed the existing Footer template to group footer template -->
<xsl:call-template name="OuterTemplate.CallGroupFooterTemplate"/>
</xsl:if>
<!-- Added an additional check to render the group footer only if grouping is enabled : end -->
<!-- New call to the Footer template-->
<xsl:call-template name="OuterTemplate.CallFooterTemplate"/>
<xsl:value-of disable-output-escaping="yes" select="$EndColumn" />
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!-- Added a new template for Header -->
<xsl:template name="OuterTemplate.CallHeaderTemplate">
<!-- Wrapper div : start ( See CallFooterTemplate for closing node tag )-->
<xsl:variable name="test" select="string('<div id="test">')" />
<xsl:value-of disable-output-escaping="yes" select="$test" />
<div id="mainHeader">Main Header ( Locate me in ContentQueryMain.xsl file to change me )</div>
</xsl:template>
<!-- Renamed template , was originally names as CallHeaderTemplate -->
<xsl:template name="OuterTemplate.CallGroupHeaderTemplate">
<div id="header">Group Header ( Locate me in ContentQueryMain.xsl file to change me )</div>
<xsl:apply-templates select="." mode="header">
</xsl:apply-templates>
</xsl:template>
<!-- Renamed template , was originally names as CallFooterTemplate -->
<xsl:template name="OuterTemplate.CallGroupFooterTemplate">
<div id="footer">Group Footer ( Locate me in ContentQueryMain.xsl file to change me )</div>
</xsl:template>
<!-- Added a new template for Footer -->
<xsl:template name="OuterTemplate.CallFooterTemplate">
<div id="mainFooter">Main Footer ( Locate me in ContentQueryMain.xsl file to change me )</div>
<!-- Wrapper div : end ( See CallHeaderTemplate for starting node tag)-->
<xsl:variable name="test" select="string('</div> ')" />
<xsl:value-of disable-output-escaping="yes" select="$test" />
</xsl:template>
Friday, March 19, 2010
Scenario:
Created a team site and wanted to use Content Query Webpart , but its missing in the list of Webparts
Solution:
Content Query Webpart is part of 'SharePoint Server Publishing Infrastructure' feature and if not activated will be missing.
Steps:
1. Navigate to Site Settings
2. Click on Site Collection features
3. Activate 'SharePoint Server Publishing Infrastructure' feature
Now you should be able to locate the webpart in gallery
Thursday, March 11, 2010
Scenario:
I think this is another common request from client. They need limited page layout but they need each layout to be very flexible. And one of them is that they should be able to decide to Show/Hide Title of the page.
Workaround can be to create 2 page layouts but thats lot to maintain for them.
Solution ( Approach 1 ):
Let me explain you the approach first.
1. Added a column/field to the Page Content Type - ShowTitle of the type Boolean
2. Added a column/field to the Page Content Type - TitleOnPage of the type Calculated Column with Formula :
=IF([ShowTitle],[Title],"")
3. Here's the Markup adjusted to handle the Show/Hide of Title
<asp:Content contentplaceholderid="PlaceHolderPageTitleInTitleArea" runat="server">Solution ( Approach 2 ):
<WebPartPages:WebPartZone runat="server" Title="loc:TitleBar" ID="TitleBar" AllowLayoutChange="false" AllowPersonalization="false"/>
<span><SharePointWebControls:ListItemProperty ID="ListItemProperty2" Property="TitleOnPage" MaxLength=40 runat="server"/></span>
<span> <PublishingWebControls:EditModePanel runat=server id="EditModePanelB">
<SharePointWebControls:TextField runat="server" id="TitleField" FieldName="Title"/>
<SharePointWebControls:BooleanField FieldName="ShowTitle" runat="server" id="BooleanField1" />
</PublishingWebControls:EditModePanel>
</span>
</asp:Content>
Tuesday, January 12, 2010
Scenario:
I was experimenting with OOTB Document Content Type by attaching a new document template to it and got the following error
The content type "System Page Layout" at "/" is sealed.
The content type "System Master Page" at "/" is sealed.
The content type "Office Data Connection File" at "/" is read only.
The content type "Universal Data Connection File" at "/" is read only.
The content type "System Page" at "/" is sealed.
The content type "Unknown Document Type" at "/" is read only.
The content type "Page Layout" at "/_catalogs/masterpage" is sealed.
Reason:
One of option while updating the content types is If you want to Update all content types inheriting from this type? which is defaulted to Yes
Basically Document Content Type is a parent to a lot of other content types , and few of them are sealed and cannot be changed. So selecting the above option to Yes will not let you proceed and will cause you this error.
Solution:
Set the option to No
Friday, January 8, 2010
Scenario:
I often need to do googling to get the content type IDs, so thought of posting it for easy reference for all of us.
Hierarchy:
Content Type IDs:
Reusable HTML 0x01002CF74A4DAE39480396EEA7A4BA2BE5FB
Reusable Text 0x01004D5A79BAFA4A4576B79C56FF3D0D662D
Page Output Cache 0x010087D89D279834C94E98E5E1B4A913C67E
System Page Layout 0x01010007FF3E057FA8AB4AA42FCB67B453FFC1
Page Layout 0x01010007FF3E057FA8AB4AA42FCB67B453FFC100E214EEE741181F4E9F7ACC43278EE811
System Master Page 0x0101000F1C8B9E0EB4BE489F09807B2C53288F
Publishing Master Page 0x0101000F1C8B9E0EB4BE489F09807B2C53288F0054AD6EF48B9F7B45A142F8173F171BD1
Office Data Connection File 0x010100629D00608F814DD6AC8A86903AEE72AA
Universal Data Connection File 0x010100B4CBD48E029A4AD8B62CB0E41868F2B0
System Page 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2
Page 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39
Article Page 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D
Welcome Page 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF390064DEA0F50FC8C147B0B6EA0636C4A7D4
Redirect Page 0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900FD0E870BA06948879DBD5F9813CD8799
Form 0x010101
Unknown Document Type 0x010104
Master Page 0x010105
User Workflow Document 0x010107
Wiki Page 0x010108
Basic Page 0x010109
Web Part Page 0x01010901
Link to a Document 0x01010A
Dublin Core Columns 0x01010B
Workflow Task 0x010801
Office SharePoint Server Workflow Task 0x01080100C9C9515DE4E24001905074F980F93160
Workflow History 0x0109
Person 0x010A
SharePointGroup 0x010B
DomainGroup 0x010C
Post 0x0110
Comment 0x0111
Far East Contact 0x0116
RootOfList 0x012001
Thursday, January 7, 2010
Scenario:
Got the following message while creating a new document.
Solution:
Install Office 2003 or Office 2007.
Scenario:
I for this error when running configuration wizard one time and other time while configuring the SharePoint User Profile Synchronization within SharePoint 2010 Beta.
An exception of type Microsoft.Office.Server.UserProfiles.UserProfileException was thrown. Additional exception information: The request channel timed out while waiting for a reply after 00:00:59.9980468. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.
Microsoft.Office.Server.UserProfiles.UserProfileException: The request channel timed out while waiting for a reply after 00:00:59.9980468. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.
Solution:
Install following hotfixes and re-boot the server without fail.
Download available here:
KB971831 - Windows Server 2008 Service Pack 2, Windows Vista Service Pack 1 or Windows Vista Service Pack 2
KB976462 - Windows Server 2008 R2 and Windows 7
Scenario:
While installing sharepoint 2010 , I got the following error
Error : An exception of the type System.Security.Principal.IdentityNotMapped was thrown. Additional exceptiomn information : Some or all identity references could not be translated.
Basically I got this error after removing the Active Directory Role from the server while running the configuration wizard.
Solution:
I dont think there is an easy way to get rid of this error. So In my opinion options are
1. Re-install the OS and then proceed.
2. Re-install sharepoint 2010.
Wednesday, January 6, 2010
Scenario:
Failed to create sample data.
An exception of type Microsoft.Office.Server.UserProfiles.UserProfileException was thrown. Additional exception information: Unrecognized attribute 'allowInsecureTransport'. Note that attribute names are case-sensitive. (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebClients\Profile\client.config line 56)
Solution:
Install following hotfixes and re-boot the server
Download available here:
KB971831 - Windows Server 2008 Service Pack 2, Windows Vista Service Pack 1 or Windows Vista Service Pack 2
KB976462 - Windows Server 2008 R2 and Windows 7
Scenario:
While installing SharePoint 2010 Beta 2 Configuration Wizard on Standalone box, I got the following error on Step 5.
Exception: System.Data.SqlClient.SqlException: Cannot open database "WSS_Search_WINSER08" requested by the login. The login failed.
Login failed for user 'Domain\Administrator'.
Reason:
Actually my closest guess is the warning I got while installing SQL sever.
Warning was : SQL Server is not supported on Domain Controller box, which is what I had.
Solution:
1. Re-install the sharepoint 2010 on a box which is not a domain controller
2. Remove the domain controller , but make sure you re-install sharepoint 2010 bits after remove the Active Directory role as otherwise you might get other error related to accounts used.