January 25, 2012

Metadata Property Mappings using PowerShell


Note: BDC Category, Check the Category Name in your Search Service App, i.e "Business Data"

Note: For PropSet --> edit the crawled property and get "Property Set ID"

$searchapp = Get-SPEnterpriseSearchServiceApplication "Search Service Application"
$category = Get-SPEnterpriseSearchMetadataCategory –Identity "SharePoint" -SearchApplication $searchapp
$crawledproperty = New-SPEnterpriseSearchMetadataCrawledProperty -SearchApplication $searchapp -Category $category -VariantType 31 -PropSet "00130329-0000-0130-c000-000000131346" -Name ows_TestProperty1 -IsNameEnum $false
$managedproperty = New-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $searchapp -Name TestProperty1 -Type 1
New-SPEnterpriseSearchMetadataMapping -SearchApplication $searchapp -ManagedProperty $managedproperty -CrawledProperty $crawledproperty

DATA TYPECRAWLED PROPERTY VARIANTTYPEMANAGED PROPERTY –TYPE PARAMETER
Text311
Integer202
Decimal53
Date and Time644
Yes/No115
Binary Data656

SharePoint 2010 PowerShell Cmdlets Reference

January 13, 2012

Referencing web part properties in SharePoint 2010 visual web part

Adding users from Different Domain - SharePoint

Just give the authenticated users Visitor access and give the url.
Once they hit the url, sharepoint creates the profile and authenticates them.

Powershell to Migrate Data From CSV


clear
Add-PSSnapin microsoft.sharepoint.PowerShell
$FilePath = "C:\Path\FAQ_List.csv"
$listurl="http://siteurl/Lists/FAQList";
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null;
$site=new-object Microsoft.SharePoint.SPSite($listurl);
$web=$site.openweb();
$list=$web.GetList($listurl);
$csv_file = Import-Csv $FilePath -Header("FAQ_ID","FAQ_Title","FAQ_PL","FAQ_Category","FAQ_Topic","FAQ_Answer");
$TaxSession =  Get-SPTaxonomySession -Site "centraladminurl"
$TermStore = $TaxSession.TermStores["Managed Metadata Service"]
$TermStoreGroup = $TermStore.Groups["GroupName"]
$TermSet1 = $TermStoreGroup.TermSets["Product Lines1"]
$TermSet2 = $TermStoreGroup.TermSets["FAQ Categories1"]
#foreach ($line in $csv_file)
for($i=0;$i -le $csv_file.Count-2; $i++)
{
 $line = $csv_file[$i];
 $PL = ('#' + $line.FAQ_PL).Split(';');
 $FC = ('#' + $line.FAQ_Category).Split(';');
 $newItem = $list.Items.Add();
 $targetPLField = [Microsoft.SharePoint.Taxonomy.TaxonomyField]$newItem.Fields["Product Lines"]
 $targetFCField = [Microsoft.SharePoint.Taxonomy.TaxonomyField]$newItem.Fields["FAQ Category"]
 $taxPLCollection = new-object Microsoft.SharePoint.Taxonomy.TaxonomyFieldValueCollection($targetPLField)
 for($k=0;$k -le $PL.Count-1; $k++)
 {
$taxonomyPLFieldValue = new-object Microsoft.SharePoint.Taxonomy.TaxonomyFieldValue($targetPLField)
if($TermSet1.GetTerms($PL[$k].Substring("1"),$true).Count -ne 0)
{
$taxonomyPLFieldValue.TermGuid = $TermSet1.GetTerms($PL[$k].Substring("1"),$true)[0].id
$taxonomyPLFieldValue.Label = $TermSet1.GetTerms($PL[$k].Substring("1"),$true)[0].Name
$taxPLCollection.Add($taxonomyPLFieldValue)
}
 }
 $targetPLField.SetFieldValue($newItem, $taxPLCollection)
 $taxFCCollection = new-object Microsoft.SharePoint.Taxonomy.TaxonomyFieldValueCollection($targetFCField)
 for($l=0;$l -le $FC.Count-1; $l++)
 {
$taxonomyFCFieldValue = new-object Microsoft.SharePoint.Taxonomy.TaxonomyFieldValue($targetPLField)
if($TermSet2.GetTerms($FC[$l].Substring("1"),$true).Count -ne 0)
{
$taxonomyFCFieldValue.TermGuid = $TermSet2.GetTerms($FC[$l].Substring("1"),$true)[0].id
$taxonomyFCFieldValue.Label = $TermSet2.GetTerms($FC[$l].Substring("1"),$true)[0].Name
$taxFCCollection.Add($taxonomyFCFieldValue)
}
 }
 $targetFCField.SetFieldValue($newItem, $taxFCCollection)
 $newItem["Title"] = $line.FAQ_Title;
 $newItem["FAQ Topic"] = $line.FAQ_Topic;
 $newItem["Answer"] = $line.FAQ_Answer;
 $newItem.Update();
}
Remove-PSSnapin microsoft.sharepoint.PowerShell

http://ravendra.wordpress.com/uploading-csv-excel-data-into-sharepoint-list/
http://www.wapshere.com/missmiis/powershell-retrieving-data-from-excel

January 11, 2012

SharePoint 2010 List Definitions and List Instances

CAS Policy

Deployment Errors In Visual Studio 2010

http://blog.incworx.com/blog/s3/deployment-errors-in-visual-studio-2010

CustomListForm Modifications

<ParameterBinding Name="ListItemId" Location="QueryString(ID)" DefaultValue="0"/>
<ParameterBinding Name="ListName" Location="None" DefaultValue="Discussion Board"/>
<ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>
<ParameterBinding Name="ManualRefresh" Location="WPProperty[ManualRefresh]"/>
<ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
<ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>

<SelectParameters><WebPartPages:DataFormParameter ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0" Name="ListItemId"></WebPartPages:DataFormParameter><WebPartPages:DataFormParameter ParameterKey="ListName" PropertyName="ParameterValues" DefaultValue="Discussion Board" Name="ListName"></WebPartPages:DataFormParameter>
</SelectParameters>
<UpdateParameters><WebPartPages:DataFormParameter ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0" Name="ListItemId"></WebPartPages:DataFormParameter><WebPartPages:DataFormParameter ParameterKey="ListName" PropertyName="ParameterValues" DefaultValue="Discussion Board" Name="ListName"></WebPartPages:DataFormParameter>
</UpdateParameters>
<InsertParameters><WebPartPages:DataFormParameter ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0" Name="ListItemId"></WebPartPages:DataFormParameter><WebPartPages:DataFormParameter ParameterKey="ListName" PropertyName="ParameterValues" DefaultValue="Discussion Board" Name="ListName"></WebPartPages:DataFormParameter>
</InsertParameters>
<DeleteParameters><WebPartPages:DataFormParameter ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0" Name="ListItemId"></WebPartPages:DataFormParameter><WebPartPages:DataFormParameter ParameterKey="ListName" PropertyName="ParameterValues" DefaultValue="Discussion Board" Name="ListName"></WebPartPages:DataFormParameter>
</DeleteParameters>

SonarQube with Jenkins Setup using Docker Images

https://funnelgarden.com/sonarqube-jenkins-docker/  https://medium.com/@hakdogan/an-end-to-end-tutorial-to-continuous-integration-and-con...