Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. SharePoint
  4. Adding spfielduservalues to a list keeps failing

Adding spfielduservalues to a list keeps failing

Scheduled Pinned Locked Moved SharePoint
dockerhelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aptiva Dave
    wrote on last edited by
    #1

    Got a list that will hold domain accounts so I can have access to their email addresses. I am using the following code to add them to the list:

    Dim exec As New SPFieldUserValue
    For Each entity As PickerEntity In sppeExecs.ResolvedEntities
    web.EnsureUser(entity.Key)
    exec = New SPFieldUserValue(web, Convert.ToInt32(entity.EntityData("SPUserID")), entity.Key)
    Next
    'now, get the list and create the item container
    Dim execList As SPList = web.Lists.TryGetList(ListName)
    If execList Is Nothing Then
    errorMessage.InnerText = "Sorry, but the Executive Director List could not be loaded. Please contact the IT Department Help Desk @ extension 2195."
    Exit Sub
    End If
    Dim execItem As SPListItem = execList.AddItem()

            'add the executive user object and set the active field to true
            execItem(Name) = exec
            execItem(Active) = True
    

    What happens is in the For Each loop at the beginning the exec variable isn't being loaded with a value. I've done this before and it has always worked, so I don't know what I must have forgotten to do.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups