Go to Central Administration
--> Manage Service Applications
--> Managed Metadata Service
--> Under Managed Metadata Service --> New Group
--> Under Group --> New Term Set
--> Under Term Set --> Create Term
--> Remember the Terminology
1. Create a Site Column with "Managed Metadata" Data Type.
2. Add this Site Column to any content type u desire.
3. Add this content type to any list or document library u desire.
Requirement: Update Metadata field in list through Code.
1. VS 2010
2. SharePoint 2010 --> Blank SharePoint Project
3. Features --> Add Feature
4. Add Elements with CustomActionGroup and CustomAction Tags
Note: Id an be any string, don't spend time to give guid.
5. Map to Layout Folders.
6. Add Application Page.
--> In ASPX page add the register tag.
<%@ Register TagPrefix="Taxonomy" Namespace="Microsoft.SharePoint.Taxonomy" Assembly="Microsoft.SharePoint.Taxonomy, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
--> Under Content Main
<Taxonomy:TaxonomyWebTaggingControl ID="myTaxonomyCntrl" runat="server">
</Taxonomy:TaxonomyWebTaggingControl>
--> In ASPX.CS Page Load Method
SPSite site = SPContext.Current.Site;
TaxonomySession session = new TaxonomySession(site);
TermStore termStore = session.TermStores["Managed Metadata Service"];
Group group = termStore.Groups["Group Name"];
TermSet products = group.TermSets["Term Set Name"];
TermCollection termCollection = products.GetAllTerms();
myTaxonomyCntrl.SspId.Add(termStore.Id);
myTaxonomyCntrl.TermSetId.Add(products.Id);
myTaxonomyCntrl.AllowFillIn = true;
myTaxonomyCntrl.IsMulti = false;
Alright, I know..References? Get the Utilities and Taxonomy from 14 Folder.
--> Button clicked Event
SPWeb spweb = SPContext.Current.Web;
SPGroup myVistors = spweb.ParentWeb.Groups["My Visitors"];
SPList SecuredDocs = spweb.Lists["Secured Documents"];
SetPermissions(SecuredDocs,myVistors);
SPField SecuredDocsField = SecuredDocs.Fields["Managed Metadata Column Name"];
SetDefaultValue(SecuredDocsField);
--> SetPermissions
private void SetPermissions(SPList lst, SPGroup grp)
{
try
{
lst.BreakRoleInheritance(true);
lst.RoleAssignments.Remove((SPPrincipal)grp);
lst.Update();
SPRoleDefinitionCollection collection = lst.ParentWeb.RoleDefinitions;
SPRoleDefinition roleDefinition = collection["Custom Permission Level"];
SPRoleAssignment roleAssignment = new SPRoleAssignment((SPPrincipal)grp);
roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
lst.RoleAssignments.Add(roleAssignment);
lst.Update();
}
catch (SPException ex)
{
lblStatus.Text = ex.Message.ToString();
}
}
--> Set DefaultValue of the Manged Metadata Column
private void SetDefaultValue(SPField field)
{
try
{
TaxonomyField TF = (TaxonomyField)field;
TaxonomyFieldValue TFV = new TaxonomyFieldValue(field);
string txt = myTaxonomyCntrl.Text;
string[] ary = txt.Split('|');
TFV.Label = ary[0].ToString();
TFV.TermGuid = ary[1].ToString(); ;
TF.DefaultValue = TFV.ValidatedString;
TF.Update();
}
catch (SPException ex)
{
lblStatus.Text = ex.Message.ToString();
}
}
---> Redirect?
SPUtility.Redirect("settings.aspx", SPRedirectFlags.RelativeToLayoutsPage, this.Context);
--> Build and Deploy ;-)
November 16, 2010
November 09, 2010
Custom Layout Page in SharePoint Designer
http://blog.henryong.com/2010/06/08/how-to-create-custom-sharepoint-2010-page-layouts-using-sharepoint-designer-2010/
November 05, 2010
Custom Feature in SP 2010
http://blogen.siderys.com/2009/04/custom-group-section-in-site-settings.html
November 04, 2010
InfoPath and Content Organizer
1. Infopath or any workflows in sharepoint 2010 wont run automatically after an item created when logged in as System Account, For any user other than Configured in Application Pool, it will run with no problems.
2. Content Organizer is set to Content Types derived form Document only.
It means when you create a new document, rules are applied.
If infopath form is created, we need to attache a workflow to send the document to repository.
Repository location is given at the bottom of content organizer settings.
Once it sent to that, rules are applied with no issues.
3. Fields in Infopath form when published from Infopath designer, are created as Optional.
These wont be showing up as properties in Content Organizer Rules.
To make them show up, first create a site column from the site.
Use this site column when publishing the infopath form.
After published, go the content type published and make the field as required.
Things will show up and folders can be created with those properties.
2. Content Organizer is set to Content Types derived form Document only.
It means when you create a new document, rules are applied.
If infopath form is created, we need to attache a workflow to send the document to repository.
Repository location is given at the bottom of content organizer settings.
Once it sent to that, rules are applied with no issues.
3. Fields in Infopath form when published from Infopath designer, are created as Optional.
These wont be showing up as properties in Content Organizer Rules.
To make them show up, first create a site column from the site.
Use this site column when publishing the infopath form.
After published, go the content type published and make the field as required.
Things will show up and folders can be created with those properties.
Subscribe to:
Posts (Atom)
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...
-
The competitive examination for the Indian Forest Service is conducted by Union Public Service Commission (UPSC). IFS exam is conducted ann...
-
Happy New Year. May this year is the year for your dreams, passions, everything you believe, your wishes, your desires, your thoughts, your ...
-
Azure Mobile App Service provides services that allow you to support mobile apps across multiple platforms. It does not provide hosting ser...