1

I'm using LINQ to Sharepoint and I've got big problem with saving entity which have user field. SPMetal generated me User field like string property, so I try tu do something like this:

SomeEntity e = new SomeEntity() { ..., User = user.ID, ... };
dataContext.XXX.InsertOnSubmit(e);
dataContext.SubmitChanges();

user variable is type of SPUser, I tried also User = user.Sid, user.LoginName and id:#domain\login name but anything of this didn't working. User field is always empty.

Please do anybody know how to correctly save item with user field?

Michal
  • 1,324
  • 2
  • 16
  • 38

1 Answers1

2

I figured it out. I wasn't too complicated :). If somebody has the some problem, SPMetal generates also property UserID which has to be set on user id. It's not needed to set up string User property.

Michal
  • 1,324
  • 2
  • 16
  • 38