SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to know the date of creation/edition and the author/editor of items in my sharepoint's Lists, but I didn't found a solution to map these columns with Entity Framework.

I tried this kind of code :

[Microsoft.SharePoint.Linq.ColumnAttribute(Name = "tp_author", Storage = "_author", ReadOnly = true, FieldType = "User")]
public SPUser Author
        return this._author;
        if (!value.Equals(this._author))
            this.OnPropertyChanging("Author", this._author);
            this._author = value;

But with that code, Sharepoint give me this error :

Invalid transfer type Microsoft.SharePoint.SPUser

I also tried with other types for _author, but it doesn't change anything.

Is there a way to make this mapping ?

Thank you

Baptiste Wicht BlockquoteMicrosoft.SharePoint.SPUser

share|improve this question
up vote 0 down vote accepted

You need to use Linq-to-SharePoint, and there is no need in Entity framework.

You need to use SPMetal to generete entity classes that Linq will work with. As I remember by default for columns creation/edition and autor/editor properties wont be generated in entity class, so you must override default generation rules to include them.

Hope it'll help.

[Update] Here's an example of xml file the will help you to generete properties for columns:

  <List Name="Employee Certifications">
    <ContentType Name="Item" Class="Certification">
        <Column Name="Author" Member="Author" />
        <Column Name="Created" Member="Created" />

By overiding default behavior I was able to create Author and Created property for my entity class, so don't give up and try once more.

share|improve this answer
Thanks for your answer, but I tried that before, but I didn't found any option in SPMetal that help me generate creation/edition and author/editor properties. I tried IncludeHiddenColumns and I also tried to use the exact intrnal name of the column, without success. – user2468 Feb 21 '11 at 11:09
I have updeted answer with example that helped me to generete hidden properties that I nedd, hope i'll help. – Andriy Shvay Feb 21 '11 at 12:34
Thanks a lot, it works well. – user2468 Feb 22 '11 at 19:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.