Solved

Get documentset fields in powershell

Posted on 2013-05-19
4
713 Views
Last Modified: 2013-05-20
I am using the following powershell to add an entry to my document set.

$web = Get-SPWeb http://mysp/products  
$list = $web.Lists["RMSpecs"]    
$cType = $list.ContentTypes["RM Spec"]    
[Hashtable]$docsetProperties = @{"RMCode"="MyRM";"RMDescription"="myStuff"}
$newDocumentSet = [Microsoft.Office.DocumentManagement.DocumentSets.DocumentSet]::Create($list.RootFolder,"My Title",$cType.Id,$docsetProperties) 

Open in new window


I end up with a new documentset in my libruary called "My Title" as expected, but the other fields I was trying to populate (RMCode and RMDescription) are blank.

How do I find out the names for these fields?     or
What am I doing wrong?

Thanks.
0
Comment
Question by:Gary_Brown_Applied
4 Comments
 
LVL 5

Expert Comment

by:milindsaraswala
ID: 39180313
Use U2U Camel Query Builder to find out the exact name of the fields which you are using
0
 
LVL 29

Expert Comment

by:QPR
ID: 39180403
try ows_RMCode and ows_RMSDescription
Failing that, try sharepoint manager or other to get the true internal names
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 39180560
Hi,
you can use this Powershell script to get both the title and the internal name of the fields - just adjust the site url and the list name:
$siteUrl = "http://dev.rainerj.local/sites/ee/"
$listName = "EEReorderFields"
$site= New-Object Microsoft.SharePoint.SPSite ($siteUrl) 
$web=$site.OpenWeb() 
$list=$web.Lists[$listName] 
$list.Fields |select ID, title, internalname | Sort-Object title

Open in new window


@QPR: the "ows_" are the names which are returned when you use the lists web service.

HTH
Rainer
0
 

Author Closing Comment

by:Gary_Brown_Applied
ID: 39182932
Thanks Rainer, showed me exactly what I needed to know.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Pimping Sharepoint 2007 without Server-Side Code Part 1 One of my biggest frustrations with Sharepoint 2007 in the corporate world is that while good-intentioned managers lock down the more interesting capabilities of Sharepoint programming in…
Summary In SharePoint 2010 it is easy to create custom color themes to jazz up a site. Theme colors can also be created in PowerPoint 2010 with a few clicks. But how do the chosen colors actually look in the SharePoint site? The attached PowerPoint…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question