Sharepoint 获取项目&x2019;元数据与实体框架?
我正在使用Sharepoint 2010 我需要知道sharepoint列表中项目的创建/编辑日期和作者/编辑,但我没有找到将这些列映射到Entity Framework的解决方案 我试过这种代码:Sharepoint 获取项目&x2019;元数据与实体框架?,sharepoint,entity-framework-4,sharepoint-2010,Sharepoint,Entity Framework 4,Sharepoint 2010,我正在使用Sharepoint 2010 我需要知道sharepoint列表中项目的创建/编辑日期和作者/编辑,但我没有找到将这些列映射到Entity Framework的解决方案 我试过这种代码: [Microsoft.SharePoint.Linq.ColumnAttribute(Name = "tp_author", Storage = "_author", ReadOnly = true, FieldType = "User")] public SPUser Author {
[Microsoft.SharePoint.Linq.ColumnAttribute(Name = "tp_author", Storage = "_author", ReadOnly = true, FieldType = "User")]
public SPUser Author
{
get
{
return this._author;
}
set
{
if (!value.Equals(this._author))
{
this.OnPropertyChanging("Author", this._author);
this._author = value;
this.OnPropertyChanged("Author");
}
}
}
但有了这些代码,Sharepoint会给我以下错误:
无效的传输类型Microsoft.SharePoint.SPUser
我也尝试了其他类型的作者,但它没有改变任何东西
是否有方法进行此映射?SPMetal为用户字段生成以下代码
[Microsoft.SharePoint.Linq.ColumnAttribute(Name="AssignedTo", Storage="_assignedToId", FieldType="User", IsLookupId=true)]
public System.Nullable<int> AssignedToId {
get {
return this._assignedToId;
}
set {
if ((value != this._assignedToId)) {
this.OnPropertyChanging("AssignedToId", this._assignedToId);
this._assignedToId = value;
this.OnPropertyChanged("AssignedToId");
}
}
}
[Microsoft.SharePoint.Linq.ColumnAttribute(Name="AssignedTo", Storage="_assignedTo", ReadOnly=true, FieldType="User", IsLookupValue=true)]
public string AssignedTo {
get {
return this._assignedTo;
}
set {
if ((value != this._assignedTo)) {
this.OnPropertyChanging("AssignedTo", this._assignedTo);
this._assignedTo = value;
this.OnPropertyChanged("AssignedTo");
}
}
}
[Microsoft.SharePoint.Linq.ColumnAttribute(Name=“AssignedTo”,Storage=“\u assignedToId”,FieldType=“User”,IsLookupId=true)]
公共系统.可为空的AssignedToId{
得到{
返回此文件。\u分配的文档;
}
设置{
if((值!=此.\u assignedToId)){
this.onPropertyChange(“AssignedToId”,this.\u AssignedToId);
这是。_assignedToId=值;
本协议项下的不动产变更(“转让文件”);
}
}
}
[Microsoft.SharePoint.Linq.ColumnAttribute(Name=“AssignedTo”,Storage=“\u AssignedTo”,ReadOnly=true,FieldType=“User”,IsLookupValue=true)]
分配给的公共字符串{
得到{
将此返回。\u分配给;
}
设置{
如果((值!=此._分配给)){
本。关于财产变更(“转让给”,本。_转让给);
该值为.\u赋值为=值;
本协议项下的不动产变更(“转让给”);
}
}
}