Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

List field vs. Content Type Field - Powershell

$
0
0

Hello,

We have a bunch of document libraries where we have a List Column that contains information.  We have recently added a content type to the libraries and would like to copy the information from the List Column to a field in the content type.

How do I use powershell to refer to these fields?

If I have the Document Library (List) as a variable $list then I assume that I refer to the field as $list.$column.  But how do I do the same for the document?   How do I iterate through each document in the library to accomplish the same thing with a for loop?

Something like:

$list = $web.GetList("My List Name")

foreach ($document in $list)

{
$document.Fields["Document Field"] = $list.Fields["List Field"]
$document.update()
}

Any help would be greatly appreciated,
Matt


Viewing all articles
Browse latest Browse all 11508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>