$spWeb= Get-SPWeb -Site "http:/intranet.contoso.com"
$spWeb.Fields | select Id,Title
$spWeb.Fields.Count
#Search for a field
#Add a Field location
$location = $spWeb.Fields| ?{$_.Title -like "Location"}
#View all FieldTypes
[System.Enum]::GetNames([Microsoft.SharePoint.SPFieldType])
if($location -eq $null)
{
$required = $false
$spWeb.Fields.Add("Location",[Microsoft.SharePoint.SPFieldType]::Geolocation,$required)
$spWeb.Update()
}
#View Fields of Type Text
$spWeb.Fields | ?{$_.Type -like "*Text*"}|select Title
$location = $spWeb.Fields["Location"]
#New content Type Location and add field to content Type
#$spWeb.ContentTypes["Holiday"].FieldLinks|select NAme
$spWeb.ContentTypes["Holiday"].FieldLinks.Add($location)
$spWeb.Update()
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$spWEb = Get-SpWeb -site "http://w15-sp"
$spWeb.FieldTypeDefinitionCollection
$spWeb.FieldTypeDefinitionCollection | select TypeName
#View count of field types
$spWeb.FieldTypeDefinitionCollection.Count
#View HTML field type
$spWeb.FieldTypeDefinitionCollection|?{$_.typeName -eq "HTML"}
#File dialog Post process id
$spWeb.FileDialogPostProcessorId
#View all files
$spWEb.Files
$spWEb.Files|select Url
$spWEb.FirstUniqueAncestor
$spWeb.FirstUniqueAncestorSecurableObject
$spWeb.FirstUniqueAncestorWeb
$spWEb.FirstUniqueRoleDefinitionWeb
$spWEb.Folders|select url
$spWeb.Fields | select Id,Title
$spWeb.Fields.Count
#Search for a field
#Add a Field location
$location = $spWeb.Fields| ?{$_.Title -like "Location"}
#View all FieldTypes
[System.Enum]::GetNames([Microsoft.SharePoint.SPFieldType])
if($location -eq $null)
{
$required = $false
$spWeb.Fields.Add("Location",[Microsoft.SharePoint.SPFieldType]::Geolocation,$required)
$spWeb.Update()
}
#View Fields of Type Text
$spWeb.Fields | ?{$_.Type -like "*Text*"}|select Title
$location = $spWeb.Fields["Location"]
#New content Type Location and add field to content Type
#$spWeb.ContentTypes["Holiday"].FieldLinks|select NAme
$spWeb.ContentTypes["Holiday"].FieldLinks.Add($location)
$spWeb.Update()
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$spWEb = Get-SpWeb -site "http://w15-sp"
$spWeb.FieldTypeDefinitionCollection
$spWeb.FieldTypeDefinitionCollection | select TypeName
#View count of field types
$spWeb.FieldTypeDefinitionCollection.Count
#View HTML field type
$spWeb.FieldTypeDefinitionCollection|?{$_.typeName -eq "HTML"}
#File dialog Post process id
$spWeb.FileDialogPostProcessorId
#View all files
$spWEb.Files
$spWEb.Files|select Url
$spWEb.FirstUniqueAncestor
$spWeb.FirstUniqueAncestorSecurableObject
$spWeb.FirstUniqueAncestorWeb
$spWEb.FirstUniqueRoleDefinitionWeb
$spWEb.Folders|select url
No comments:
Post a Comment