Run the following script from SharePoint 2010 Management Shell.
Then REMEMBER to perform IISReset in order for the new section to appear on the Manage User Properties page (Alternatively wait for 1 hour for the timer job to run and perform the required synchronization).
---------------------------------
#The script is to create/update User Profile section
#
param([string] $siteURL, # Site Collection URL
[string] $name,
[string] $displayName,
[int] $displayOrder
)
try
{
$context = Get-SPServiceContext -Site $siteUrl;
$cm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager($context);
$pcol = $cm.GetPropertiesWithSection();
$exists = $false;
foreach ($temp in $pcol)
{
if ($temp.Name -eq $name)
{
Write-Host "Section $name Exists!";
$exists = $true;
$p = $temp
}
}
if ($exists -ne $true)
{
$p = $pcol.Create($true);
}
$p.Name = $name;
$p.ChoiceType = [Microsoft.Office.Server.UserProfiles.ChoiceTypes]::Off;
$p.DisplayName = $displayname;
$p.Commit();
$pcol = $cm.GetPropertiesWithSection();
$pcol.SetDisplayOrderBySectionName($p.Name, $displayOrder);
$pcol.CommitDisplayOrder();
Write-Host -ForegroundColor Green "Section $name created/updated successfully!";
}
catch
{
Write-Host -ForegroundColor Red $_
Exit 1
}
Thursday, March 29, 2012
Monday, April 4, 2011
Updating Taxonomy field with default value
Writing to columns based on the Managed Metadata field type is a little
different from writing to columns of other types. First, get a reference to the column in the
list, and then call the SetFieldValue() method to update the value of a specific list item, as
shown in the listing below:
ListselectedTerms = new List (); selectedTerms.AddRange(terms.ToList());TaxonomyField locationTags = listItem.Fields["Location Tag"] as TaxonomyField;locationTags.SetFieldValue(listItem, selectedTerms);listItem.Update();
Tuesday, June 9, 2009
View hidden web parts in a SharePoint page.
To view all the hidden webparts on your SharePoint page, add "contents=1" to the page's URL.
For example: http://yoursite/whatever/default.aspx?contents=1
For example: http://yoursite/whatever/default.aspx?contents=1
Tuesday, May 12, 2009
Visual Studio 2010 - SharePoint support
http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx
SharePoint Development in Visual Studio 2010
Microsoft Visual Studio 2010 marks a major advance in usability and functionality for SharePoint developers, helping you accomplish tasks like:
SharePoint Development in Visual Studio 2010
Microsoft Visual Studio 2010 marks a major advance in usability and functionality for SharePoint developers, helping you accomplish tasks like:
- Customizing SharePoint with the help of new project and item templates.
- Creating Web parts and application pages using new visual designers.
- Designing association and initiation forms for your workflows.
- Aggregating and integrating back-end data into your application using Business Data Catalog (BDC) models.
- Importing existing solution packages (.wsp files) and then modifying and extending them.
- Customizing features and packages using new designers and explorers.
- Deploying and debugging SharePoint applications as easily as pressing F5.
- Navigating SharePoint sites using Server Explorer.
Wednesday, April 15, 2009
Enable debugging info for a SharePoint site
To enable debugging for a SharePoint site, there are three settings in the default web.config that need to be updated:
1.SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false"
2. customErrors mode="Off"
3. compilation batch="false" debug="true"
1.
2. customErrors mode="Off"
3. compilation batch="false" debug="true"
Subscribe to:
Posts (Atom)