Set multi user column with PowerShell used to work in 2010 but no longer works in 2013

In SharePoint 2010 I used PowerShell to set the value of multi user people columns and it worked really well.  I attempt to use the same PowerShell to set the same column type in SharePoint 2013 and it fails.
here is the PowerShell that I use in 2010:
$web = Get-SPWeb "http://intranet"
$list = $web.lists["TestList"]
$item = $list.items.add()
$item["Title"] = "Test multi user column"
$users = @("Domain\user1", "Domain\user2")
$userList = new-object Microsoft.SharePoint.SPFieldUserValueCollection
foreach($user in $users)
$spUser = $web.EnsureUser($user)
$userValue = new-object Microsoft.SharePoint.SPFieldUserValue($web, $spUser.ID, $spUser.Name)
$userList.Add($userValue)
$item["MultiUserColumn"] = $userList
$item.update()
I have used this on three SharePoint 2013 farms with differing results.  On two of them I receive an error when running $item.update(): Exception calling "Update" with "0" argument(s): "Invalid look-up value.  A look-up
field contains invalid data. Please check the value and try again."
If I take one of the users out of the $users list then it works fine, but it will not allow multiple users to be set with PowerShell.  I can use the GUI to add more than one user but not PowerShell.
Does anyone know if these methods have changed in 2013? I haven't been able to find anyone else with this issue.
mmm... coffee...

Not sure but maybe something to do with casting. Below is the code snippet from one of the blogs. Try modifying your script like below and see if still you get the error
[Microsoft.SharePoint.SPFieldUserValueCollection]$lotsofpeople = New-Object Microsoft.SharePoint.SPFieldUserValueCollection
$user1 = $w.EnsureUser("domain\user1");
$user1Value = New-Object Microsoft.SharePoint.SPFieldUserValue($w, $user1.Id, $user1.LoginName)
$user2 = $w.EnsureUser("domain\user2");
$user2Value = New-Object Microsoft.SharePoint.SPFieldUserValue($w, $user2.Id, $user2.LoginName);
$lotsofpeople.Add($user1Value);
$lotsofpeople.Add($user2Value);
$i["lotsofpeoplefield"] = $lotsofpeople;
$i.Update();
#-or-
$l.Fields["lotsofpeoplefield"].ParseAndSetValue($i,$lotsofpeople);
$i.Update();
Reference to the link
http://social.technet.microsoft.com/wiki/contents/articles/20831.sharepoint-a-complete-guide-to-getting-and-setting-fields-using-powershell.aspx
Geetanjali Arora | My blogs |

Similar Messages

  • How to set Multi User Environment in the weblogic 5.1 and 6.1 server..(Urgently)

    Hi all,
    I need to know how to set Multi User Environment in the weblogic 5.1
    properties file..
    Here my question is..:)
    1) I have a database with multiple users and having different privileges
    for the users.. and i need to use all the privileges when user aceess
    the database through weblogic server connectionPool.
    2)According to the user privileges i need access the database tables
    content and gives the frontEnd(jsp).
    3)How to modify dynamically weblogic.properties file in the weblogic
    5.1.
    If anybody having idea reg. this issues pl...help me..
    Thanks in advance
    Chandu([email protected],[email protected])

    Hi. A JDBC connection pool is a set of identical, interchangeable, pre-made
    connections, and the controls to make sure only one user uses a particular
    connection at any one time. If you want to have different DBMS users, you can
    have a separate pool for each DBMS user, which may contain as many or few
    connections as you want. Some applications has a pool for the accounting
    applications, and another for the sales applications etc. Some do have a
    separate pool for john, jane, joe etc, each with one connection. Pools
    can be created and destroyed dynamically using the dynamic pool API.
    Joe
    softstar wrote:
    >
    Hi all,
    I need to know how to set Multi User Environment in the weblogic 5.1
    properties file..
    Here my question is..:)
    1) I have a database with multiple users and having different privileges
    for the users.. and i need to use all the privileges when user aceess
    the database through weblogic server connectionPool.
    2)According to the user privileges i need access the database tables
    content and gives the frontEnd(jsp).
    3)How to modify dynamically weblogic.properties file in the weblogic
    5.1.
    If anybody having idea reg. this issues pl...help me..
    Thanks in advance
    Chandu([email protected],[email protected])

  • Exchange 2010 - Setting up Users Calendar with Free /Busy Details share permssion, Outlook 2007 client cannot open

    Setting up Users Calendar with Free /Busy Details share permssion, Outlook 2007 client cannot open the user shared folder but if we use OWA 2010 or Outlook 2010 client no issue opening the user shared calendar with Free/Busy Details setting.
    The follwowig error is reported
     You do not have sufficient permission to open the calendar folder. you don't have appropriate permission to perform this operation.
    thanks,
    Hussain

    Setting up Users Calendar with Free /Busy Details share permssion, Outlook 2007 client cannot open the user shared folder but if we use OWA 2010 or Outlook 2010 client no issue opening the user shared calendar with Free/Busy Details setting.
    The follwowig error is reported
     You do not have sufficient permission to open the calendar folder. you don't have appropriate permission to perform this operation.
    thanks,
    Hussain
    I built this little command from the "CalendarProcessing" commandlet...  it cleared up my issues ...
    Set-CalendarProcessing -Identity joeuser -AddNewRequestsTentatively $false -AddOrganizerToSubject $true -AllBookInPolicy $true -AllowConflicts $true -AllowRecurringMeetings $true  -AutomateProcessing AutoUpdate -BookingWindowInDays 0 -ConflictPercentageAllowed
    50 -DeleteAttachments $false -DeleteComments $false -DeleteNonCalendarItems $false -DeleteSubject $false -EnableResponseDetails $true -EnforceSchedulingHorizon $true -ForwardRequestsToDelegates $false -MaximumConflictInstances 100 -MaximumDurationInMinutes
    0 -OrganizerInfo $true -ProcessExternalMeetingMessages $true -RemoveForwardedMeetingNotifications $true -RemoveOldMeetingMessages $true -RemovePrivateProperty $false -ScheduleOnlyDuringWorkHours $false -TentativePendingApproval $false -WhatIf
    Look at those settings in technet article dd335046
    good luck
    JLH

  • Im having problem setting up my Hotmail account, it used to work fine until few days ago. It says ive entered an incorrect username or password which i can sign in fine with them details if i use laptop or safari through the phone, Please help..

    Im having problem setting up my Hotmail account, it used to work fine until few days ago. It says ive entered an incorrect username or password which i can sign in fine with them details if i use laptop or safari through the phone, Please help..

    I Sugges you to log into your hotmail acc and go to security and password change bit, then you will see two-step verification.. turn that off and you will be able to set it up on your iPhone/iPad or even Mac.
    Give your phone a restart before trying to set it up. Thanks

  • How to add ProxyAddress attribute to multiple users? with powershell

    I need to add the attribute ProxyAddress several users at once, in AD 2008 R2. with powershell.
    Thanks beforehand.

    Hi,
    Use Set-ADUser:
    http://ss64.com/ps/set-aduser.html
    See the -Add parameter.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • How to set which User Profile attribute is used for email messages?

    I am having a problem setting up User Profiles in SharePoint 2013. I have users that are both (1) Active Directory users authenticated using Windows Authentication, and (2) Active Directory users, existing in another distinct OU, authenticated via ADFS (active
    directory federation services).
    My problem is with the ADFS users. I want to have the users unique id be their logon email account ([email protected]), but want to populate their work email attribute with their "actual" or real email account.
    If I have an OU (External Users) and within that OU (XYZ Company Users), AND my domain is contoso.com, then I want to add a user such that they have a unique id in active directory ([email protected], but want their email address to be whatever
    it is (I.e. [email protected]).
    MY PROBLEM: I can setup the User Profile Synchronization service to map the properties perfectly, but when I I try to add/share a user in a SharePoint site, the user's account email ([email protected] is sent the message, not their "Work Email"
    ([email protected]).
    QUESTION: How do I get SharePoint to use the "Work Email" attribute (NOT the account email) of a User Profile when sending email messages?

    Okay, within Active Directory, the user's email IS set to
    [email protected] The "unique value" (Using the account logon name) works just fine. The problem is SharePoint. When I logon with another account and choose to share a site with this particular test user, the Email for sharing the site is sent to
    [email protected] (the account logon name), not
    [email protected] (the user's email address)
    How do I get SharePoint to actually use the email address of an AD user, and not use the account logon name when sending notifications?

  • How to manage a connection with powershell using visual studio with C#

    Hi
     I want to manage a connection with powershell for a web app using visual studio with c#. and also run command with pipeline 
    Plz give a some suggestions..

    Hi Raj_Kumar_Saini,
    To make things clear, could you please clarify these thing?
    1. Do you mean you want to execute some PowerShell scripts from C# language? These blogposts may give you  some ideas:
    Executing PowerShell scripts from C#
    Powershell Automation and Remoting (a c# love story)
    Execute PowerShell from a ASP.NET Web Application
    2. Is your question related to Visual Studio Integration? Do you want to build a Visual Studio Extension?
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Linked column with # sign doesn't work in report results

    I have a 2 page query situation, whereas in the 1st page I have a wildcard query to find a product number.
    This product number is set-up as link to run a report which opens in another page.
    (Type is a STRING.)
    Everything works fine unless the product number starts with the # sign.
    I can run a report using this in a non-linked page, but it doesn't work in the linked page...?
    Simple queries
    Page 1
    select
    from
    Products
    WHERE (((upper(TOP_ITEM) like upper(:P1_SEARCH)||'%')))
    and :P1_SEARCH is not null
    (Link on Top Item - :P2_Search)
    Page 2
    select
    from
    Products
    where Top_Item = :P2_Search
    (This works fine if I enter the #[Product] into the text field)
    Link doesn't work...?

    You need to escape the "#" character in the product no and generate the link's HTML code in report #1 directly within the SQL query.
    select ..
       ,'<a href="f?p=REPLACE(product_number,'#',''%23)
      ,'<a href="f?p=' || :APP_ID || ':200:' || :APP_SESSION || '::NO::P200_PRODUCT_NUMBER:' || REPLACE(product_number,'#','%23') || '"> Link</a>' product_number_link
    FROM ..
    {code}
    <i> 200 is report #2's page
    P200_PRODUCT_NUMBER is report #2's page item which is set on redirecting to that page.
    Product_number is the column name of column with '#' characters
    Change display type of product_number_link column to "standard report type"</i>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • User profiles with multiple login accounts in SharePoint 2010

    Hello,
    Consider the following scenario:
    We have Active Directory that is accessible inside our network. Except the sites, accessible from the corporate network, we are exposing SharePoint sites from the same farm on the internet, using claims based authentication with ADFS 2.0 using the same
    AD instance as in the intranet.
    The problems is that the claims based accounts are not linked to the profiles, that are created for the users by the User Profiles Synchronisation service.
    Is there a way to configure the user profiles so if our users are signing in from internet, to access the same profiles that they have, when accessing the SharePoint sites from intranet?
    (I've searched a lot, I didn't find excat solution. I've found something related to SPCLaims properties and had confugred them to sync with the AD using the "claims" trusted connection, but the problem remains.)
    This is simmilar to allow our users to login using their Facebook, Google, OpenID identity or the identity in our AD. How can this be done?

    SharePoint user profiles are not populated automatically when using claims-based authentication methods. You must create and populate these profiles yourself, typically in code. Users that map to existing accounts when you migrate to claims-based authentication
    will use any existing profile information, but other users and new users will not have profile information. For information about how you can populate user profiles when using claims-based authentication, see "Trusted Identity Providers & User Profile
    Synchronization" at
    http://blogs.msdn.com/b/brporter/archive/2010/07/19/trusted-identity-providers-amp-user-profile-synchronization.aspx.
    The same limitation occurs when using SharePoint Audiences. You cannot use user-based audiences directly unless you create custom code to support this, but you can use property-based audiences that make use of claims values. For information, see "Using Audiences
    with Claims Auth Sites in SharePoint 2010" at
    http://blogs.technet.com/b/speschka/archive/2010/06/12/using-audiences-with-claims-auth-sites-in-sharepoint-2010.aspx.
    From: http://msdn.microsoft.com/en-us/library/hh446523.aspx

  • Trying to delete a file with Powershell script ran by a service but issues with uac

    I'm having issues with a script that will delete a file on the C-Drive of a server. the script looks like this:
    param(
    [Parameter(Mandatory=$true)][string]$hostname
    $StrFileName = "C:\Program Files\NSClient++\nsclient.log"
    $LogLocal="c:\Nagios\naf_delete_nscp_log_file.log"
    $Date = Get-Date -Format "yyyy-MM-dd hh:mm:ss"
    "$date : NSClient logfile deletion requested on $hostname" | Out-File -filepath $LogLocal -Append
    If (Test-Path "$strFileName"){
    Remove-Item $strFileName -Force
    $Date = Get-Date -Format "yyyy-MM-dd hh:mm:ss"
    "$date : NSClient logfile deleted on $hostname" | Out-File -filepath $LogLocal -Append
    The script is initiated from a Nagios quick action which will use nrpe to pass the host as parameter and make the nscp service, which runs as local system, run it. It works perfectly on servers that have no uac enabled, but I can't get it to work on servers
    with uac. I've tried numerous options, but none seem to work. Any tips or advice to get this working with Powershell v2 code on servers with uac enabled is highly appreciated.
    Thanks.
    Willem

    Hi Willem,
    one thing to note: I don't see why your script itself has a hostname parameter.
    One way around UAC has always been the Windows Task Scheduler. If you register a task as System run and triggered by an event, you can simply call the event locally (which doesn't require admin permissions) and it will perform the task.
    I don't know how your Nagios construct works and the script by itself doesn't make much sense. If you want advice on how to do this without resorting to tasks, I'd need to know more about the system you are using.
    Cheers,
    Fred
    There's no place like 127.0.0.1

  • View containing custom column works in SharePoint 2010 but crashes webpart in SharePoint 2013

    First off.. I am using SP FOUNDATION.  Secondly, I'm linking a contact library from a parent site to a view on a sub site. This works in SP 2010 but when I tried to duplicate it in our new SP 2013 site, it doesn't.
    Reproduce steps to add Parent Contact Picks to Blog Sub-Site in SP 2010 (Foundation)
    In parent site, create a contact list (add some people)
    In parent site à Site Settings
    à Site Columns … create a new Column of type “Lookup”. 
    Set the Information Source to the Contact List in step 1 with its Column = “Last Name (linked to item)” 
    Create a BLOG sub site
    BlogSite à Site Settings
    à Site Libraries and Lists
    à Posts
    à Add from existing site columns …. Select the Lookup column you created in step 2.
    BlogSite à Site Settings
    à Site Libraries and Lists
    à Posts
    à Create View à Standard View….Create a new view and select ONLY the lookup column from step 4.
    Add a new Blog post and while in the ‘New-Item’ form, make sure to select a person from the Contact list.
    Open up the details page of the new post so that only the single post shows. Edit the Page and Insert a New Web Part
    à Lists and Libraries
    à Posts.
    Edit the newly added web part and change its view to the one created above in step 5.
    Drop the down arrow to the right of the newly added web part’s title and select Connections
    à Get Filtered values From
    à Post [1] (or whatever the default Post Web part is called). Set both the “Provider” and the “Consumer” field names to “ID”.
    You will now see that whenever you open the “Details” page of any blog post, you will see the Main post (aka the original form), the normal “Add Comment” entry web part, AND 
    the new web part that show the Contact selection specific to that single post. Clicking on the Name of the contact will actually pop up the details from the parent site.
    SharePoint 2013 (Foundation)
    Now perform the exact same steps in SharePoint 2013. However you’ll notice that Step 8 above appears to work but as soon as you try and edit that web part again or move on to step 9, the newly added web part states “Unable to display this Web Part. To troubleshoot
    the problem….. Correlation ID: 52d36c9c-e7a2-509e-1d60-3df1ce53ce2d”.
    Followup: In doing some testing I determined the following..
    1 - If I adjust step #5 as to NOT select the new linked column.. it works. Oddly however, the new view works when are you just using the view by itself (/site/lists/Posts/NewViewname.aspx).
    2 - I can fix the crash by enabling the 'Server Render' option on the WebPart. This actually now shows my information however the linked field is no longer a link.
    3 - As long as it's not a Lookup type column, I can follow the same process and do not need the Server Render option. Of course these other types are not live links.
    Seems like a bug to me.

    I set "Breakline" hidden because I don't want to show this in create new item form. 
    I realized that may be the reason. So changed the column to Optional in CT and created a new calendar using that CT. then at list level CT I changed it to Hidden.  That works.   The column is available for use when modifying view.
    Thanks

  • NEED TO ENABLE BULK USERS on LYNC 2010 WITH POWERSHELL using SAMACCOUNTNAME

    Currently I am using following command;
    Import-Csv C:\Scripts\Users.csv | ForEach-Object{$varUserId=$_.userid; Enable-CsUser -Identity $varUserid -RegistrarPool gn-a-if-lync01.iyogi.net -SipAddressType samaccountname -sipdomain iyogi.net}
    WHENEVER I RUN THIS COMMAND I GET FOLLOWING ERROR, MAY BE SOMETHING IS WRONG HERE:
    Enable-CsUser : Management object not found for identity "waseem.raza".
    At C:\Scripts\lyncuser.ps1:1 char:85
    + Import-Csv C:\Scripts\Users.csv | ForEach-Object{$varUserId=$_.userid; Enable
    -CsUser <<<<  -Identity $varUserid -RegistrarPool gn-a-if-lync01.iyogi.net -Sip
    AddressType samaccountname -sipdomain iyogi.net}
        + CategoryInfo          : NotSpecified: (:) [Enable-CsUser], ManagementExc
       eption
        + FullyQualifiedErrorId : Microsoft.Rtc.Management.AD.ManagementException,
       Microsoft.Rtc.Management.AD.Cmdlets.EnableOcsUserCmdlet
    Any help is appreciated :)
    Thanks,
    RIWAA
    RIWA

    Hi RIWAA,
    The help for Enable-CsUser clearly states that sAMAccountName is not a valid option for the Paramter -Identity
    I quote the description of the paramter:
    "Indicates the Identity of the user account to be enabled for Lync Server. User Identities can be specified
    by using one of four formats: 1) the user's SIP address; 2) the user's user principal name (UPN); 3) the user's domain name and logon name, in the form domain\logon (for example, litwareinc\kenmyer); and, 4) the user's Active Directory display name (for example,
    Ken Myer). You can also reference a user account by using the user’s Active Directory distinguished name.
    You can use the asterisk (*) wildcard character when using the Display Name as the user Identity. For example, the Identity "* Smith" returns all the user who have a display name that ends with the string value " Smith"."

  • Guest user enabled with restricted use to adminisrtator

    i have a macbook pro mid 2012.  the guest user account enabled and manages itself.  I cannot disable it because it is restricted use that me the administrater does not have access to.. I have to logf in   and log out with the guestuser account  then switch to to me the administater . 
    How can I disable it ?

    I'm not sure I understand your question, but if you log out of the guest account, you should then be able to disable it in the Users & Groups preference pane after authenticating.

  • Set up time capsule with PC using ethernet

    Hi,
    I have a Time Capsule which I want to use as a wireless router.
    I have two PCs - a desktop without a wireless card, and a laptop with one.
    My internet connection requires a SecureID password, so whenever it disconnects (for any reason) I have to enter a new password.
    To the best of my knowledge this can only be done from the AirPort utility - and that is only possible from a PC with a wireless card.
    As the laptop is not always home, I'd like to be able to do this with my desktop, which is equipped with a wired LAN card and does not have a wireless card.
    Is there a way to do this?
    Thanks,
    Omri

    Thanks.
    I tried it, and the airport utility just said that it cannot detect any wireless apple devices.
    In the Time Capsule manual, it also says that the time capsule can be configured either by a Mac with wireless/ethernet or with a PC with wireless.
    I solved the problem by buying a cheap PCI wireless card for my desktop.

  • How to set dialog to tofront with out using modal?

    i'm using toFront() method in my application in focusgained & window activated but it is not working on solaris.what to do?

    Prepaid cards are not available in New Zealand since the iTMS isn't available there. The only way you could purchase from the iTunes Music Store would be of someone in a country that has one were to purchase a card in that country, send it to you, and allow you to set up an account using their mailing address.

Maybe you are looking for

  • I can't get to any websites using Firefox or IE but AOL works fine.

    When I open Firefox or IE, the home pages are fine but then both just hang without loading any websites. Both just show the progress wheel circling. Sometimes clockwise green and sometimes counter clockwise gray. No issues with AOL. Problem started a

  • Does my ipad make duplicates when i put photos in albums?!

    Hi, Does my iPad make duplicates when i put them in albums? They apear on filmrol(photolist?) and when i try to delete it says: "delete everywhere?" Another aspect (probably a bigger concern) of why this has my concern, is that it says i have 7.2 GB

  • Printing Checks from Oracle r12

    I'm not too sure on where I should have put this post because I really don't know anything about Oracle. In my company I handle Server and PC maintenance mainly. The only thing I do with Oracle is I have to run a report every morning. The people in t

  • Automator attachment-pdf-save-archive

    Can anybody recommend an Automator OS Application that could do the following: 1) Once the email is received => it opens the attachment usually MS Words or Pages 2) Exports the attachment as PDF 3) Save PDF file in a specific folder 4) Archives the e

  • About Buying Flash

    Hello. I am considering buying Flash and PhotoShop. I believe Flash and PS latest versions are $700 each. But I guess buying one of those packages (eg. Production Premium) around $1800 is much more logical which include many more programs. They are e