MOSS 2007 CMS Project Technical Issues: Custom Field Type

Until now, I have been in the CMS team for almost six monthes. During this past period, I knew a lot about MOSS 2007 with SP1, that's a not good experience because of both the technique lack and some weird places in it. Below I list the issues I met in our project, and hope it could be userful for your future project.

1) Custom field type. In MOSS 2007, there is the possibility you can create your own field type using "custom field type". Here, I met two points should be mentioned: First is you shold add some code to handle the custom property, because the property will lost with only once-save-action. Sample:

Normally, you should set/get the custom property like below way:

public override void Update()
{
this.SetCustomProperty("SourceWeb", this.SourceWeb);
base.Update();

}

Unfortunately, you should do it like below way:

public override void Update()
{
this.SetCustomProperty("SourceWeb", this.SourceWeb);
base.Update();

if (updatedSourceWeb.ContainsKey(ContextId))
{
updatedSourceWeb.Remove(ContextId);
}

}

private string sourceWeb;
public string SourceWeb
{
get
{
return updatedSourceWeb.ContainsKey(ContextId) ? updatedSourceWeb[ContextId] : sourceWeb;
}

set
{
this.sourceWeb = value;
}
}

public int ContextId
{
get
{
return SPContext.Current.GetHashCode();
}
}

public void UpdateSourceWeb(string value)
{
updatedSourceWeb[ContextId] = value;
}

2) There is a known issue about the custom field type. After the custom field is deployed on the server, you can find the properties in the editor page correctly, but when you new a document, in the pop-up property dialog window, you can not find the corresponding fields. About this bug of Microsoft , you can solve it using sp1 of MOSS 2007. Now the sp1 has been available.

3) About the deployment of custom fields, some pages/controls/xmls are necessary, you can find the related documents from googling sites. Because it's difficult to know what happens when it goes live, the detailed log service are strongly recommanded here, certainly you alos can refer to the huge logs from MOSS 2007 (.../1033/logs/...).

posted on 2007-12-24 15:19  hanfey  阅读(1149)  评论(0编辑  收藏  举报

导航