?
Solved

Get documentset fields in powershell

Posted on 2013-05-19
4
Medium Priority
?
776 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

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…
When using a search centre, I'm going to show you how to configure Sharepoint's search to only return results from the current site collection. Very useful when using Office 365 with multiple site collections.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

777 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