Monday, October 1, 2012

Mobile Entree For SharePoint 2010

Hi Friends,

This week I was involved in one POC on Mobile Development of SharePoint 2010. There I came around Mobile Entree Server(ME). Please check ME details:

Mobile Entree is a SharePoint solution for developing mobile solutions within SharePoint features and allow access to SharePoint APIs. Just install ME(Mobile Entree) on a SharePoint Farm and start using its power to create Mobile Apps instantly. Its allows number of great features to work with.

Refer below links:

1. http://blogs.msdn.com/b/seanpirtle/archive/2010/03/04/mobile-entree-s-mobile-sharepoint-solution.aspx
2. http://www.h3s-inc.com/services/Pages/Mobile-Entree-Development.aspx

Thanks
Prabhat

Tuesday, September 4, 2012

PowerShell To Change Set Default Page

PowerShell Script To Set a New Default Page:

$site = Get-SPSite http://server/sites/sitename
$web = $site.RootWeb
$folder = $web.RootFolder
$folder.WelcomePage = "Shared%20DocumentLibrary/CustomPage.aspx")
$folder.update()
$web.Dispose()
$site.Dispose()
 
Thanks 

Enable “Audit Log Reports” in Site Settings Page

Hello Friends,

Many times we need to generate Audit Reports in SharePoint Sites. To enable this link in Site Settings we need to activate "Reporting" Site Collection Level Feature.

PowerShell Script To Enable  “Audit Log Reports”:

Enable-SPFeature –identity "Reporting" -URL $url -ErrorAction SilentlyContinue

This way we can create number of scripts including Custom one.

Happy Reading!!!

Monday, September 3, 2012

PowerShell To create Retention Policies for Content Types

Hi Friends,

PowerShell is really a very powerful tool. Its not just a command prompt, we can also do coding into this.
Here I am using Powershell to create Policies on Content Types. I am creating Retention Policies and Auding Policy on Content Types. I am using One file "D:\Test\ContentTypes.txt" which contains data(content types) description according which we are applying Policies on those.

Data in the "D:\Test\ContentTypes.txt" will be in following format:

Name,Property,Period,PeriodType
One CTypeName,Created,15,Years
Two CTypeName,Created,25,Years
Three CTypeName,Created,Permanent,Years

function  abc()
{
$url = "http://server:1717/sites/TestTopLevelSite/"

$site = get-spsite $url
$web = $site.openweb()

Enable-SPFeature –identity "LocationBasedPolicy" -URL $url -ErrorAction SilentlyContinue

$CTList = Import-Csv D:\Test\ContentTypes.txt

echo "Processing Content Types"

ForEach ($item in $CTList){

$Name = $($item.Name)
$Property = $($item.Property)
$Period = $($item.Period)
$PeriodType = $($item.PeriodType)

$contentType = $web.ContentTypes[$Name]

if (($Period -ne "IND") -or ($Period -notcontains "MAX")) {

if($contentType){

[Microsoft.Office.RecordsManagement.InformationPolicy.Policy]::CreatePolicy($contentType, $null);

$newPolicy = [Microsoft.Office.RecordsManagement.InformationPolicy.Policy]::GetPolicy($contentType);

$newPolicy.Items.Add("Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration",
 "<Schedules nextStageId='3'>"+
 "<Schedule type='Default'>"+
 "<stages>"+
 "<data stageId='1' stageDeleted='true'></data>"+
 "<data stageId='2'>"+
 "<formula id='Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration.Formula.BuiltIn'>"+
 "<number>"+$Period+"</number>"+"<property>"+$Property+"</property>"+
 "<period>"+$PeriodType+"</period>"+
 "</formula>"+
 "<action type='action' id='Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration.Action.MoveToRecycleBin' />"+
 "</data>"+
 "</stages>"+
 "</Schedule>"+
 "</Schedules>");

$newPolicy.Items.Add("Microsoft.Office.RecordsManagement.PolicyFeatures.PolicyAudit",
 "<Audit>"+
 "<Update />"+
 "<View />"+
 "<CheckInOut />"+
 "<MoveCopy />"+
 "<DeleteRestore />"+
 "</Audit>");

$newPolicy.Update();

}
}
}

$web.Dispose()
$site.Dispose()

echo "Finished!!!"

}

Happy Reading!!!

SharePoint 2010 Solution Deployment Gets Hanged

Hi Friends,

During a SharePoint 2010 Solution Deployment its gets hanged and its hanged in "solution-deployment-solutionName.wsp-0".

To resolve this issue we should try the below steps:
1. Stop SPAdminV4
2. Start-SPAdminJob
3. Start SPAdminV4

Example :

$spAdminServiceName = "SPAdminV4"
Stop-Service -Name $spAdminServiceName
Start-SPAdminJob -Verbose
Start-Service -Name $spAdminServiceName

Thanks
Prabhat

Thursday, August 30, 2012

Use Powershell To Create Taxonomy Group, TermSet and Term in SharePoint 2010

Hi Friends,

Many times we are required to create Terms and TermSets in Managed Metadata Service Term Store using PowerShell. So here are cmdlets for that purpose.

$SPtaxonomySession=Get-SPTaxonomySession -Site "http://servername:11/"
$termStore=$SPtaxonomySession.TermStores["ManagedMetadataService"]
$temGroup=$termStore.CreateGroup("MMS Group")
$termSet=$temGroup.TermSets["Legal"]
$termOne=$termSet.CreateTerm("Legal Document",1033)
$termStore.CommitAll()

Thanks