Solved

Get documentset fields in powershell

Posted on 2013-05-19
4
695 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Microsoft SharePoint Foundation 2010 and Microsoft SharePoint Server 2010 do not offer the option to configure the location of the SharePoint diagnostic trace log files during installation.  This can, however, be configured through Central Administr…
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

861 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now