none
ContentType User field linq to SharePoint

    Întrebare

  • Hi,

    I need to read data with linq from a userfield which i have deployed by content type:

    <Field ID="{G54B9954-99AA-49FA-BB2F-606FV6EGH118}"
           Type="UserMulti"
           DisplayName="TestOwner"
           Group="Testgroup"
           StaticName="TestOwner"
           Name="TestOwner"
           Mult="TRUE"/>

    But i get only the Displayname like "Peter Pan" and not the login name. When i change the "show field" value with the user interface for this field to "account" it works. But i cannot change this declarative in the content type xml... 

    i don't want to change this manually to not loose the relation of the content type and the definition...

    any ideas would be great!

    Thanks!

    Pascal

    31 martie 2012 14:30

Răspunsuri

  • Hi Pascal,

    If you just want to get the user login name information from linq to SharePoint, you can use SPFieldUserValue.user.LoginName property during the query.

    SharePoint field definition for user and group field doesn’t provide a way to change show field value in the definition file, if you want to achieve this, you may consider customizing field inherit from the user field, here is an article about this, you can refer to it for more information:
    http://pholpar.wordpress.com/category/custom-fields/

    Thanks,
    Qiao


    Qiao Wei

    TechNet Community Support

    2 aprilie 2012 09:02