Notes with Custom Document ID in MOSS 2010
ma
MOSS 2010 provides Document ID Services that allows get the document with unique key, and do not care about the document or folder will be renamed.
You can develop a Custom Document ID Services and can define the format of DocumentID.
You need to take care about:
* DoCustomSearchBeforeDefaultSearch
This is a variable with Boolean datatype, if it sets TRUE, the custom GetDocumentUrlsById will be call before the default Search function and FALSE for default Search function.
But if the GetDocumentUrlsById return an empty array, the default Search function will be called.
* GetDocumentUrlsById
Incase you override this method, if you did not found the document never return an array string with one empty item you will get an exception (a Microsoft trap ?
)
string[] res = new string[1];
res[0] = string.Empty;
public override string[] GetDocumentUrlsById(SPSite site, string documentId)
{
//Find new Document ID
string result = getDocIdUrl(site, documentId);
string[] res;
if (!string.IsNullOrEmpty(result))
{
res = new string[1];
res[0] = result;
}
else
{
try
{
//Find Document has been crawled
string[] links = DocIdLookup.DoSearch(site, documentId);
if (links != null && (links.Length > 0))
{
res = new string[1];
res[0] = links[0];
}
else
{
res = new string[0];
}
}
catch
{
res = new string[0];
}
}
return res;
}
Comments
Post a Comment