IsUploadDocumentUri Method (original) (raw)
Summary
Indicates whether the URL points to a special LEAD cache scheme.
Syntax
public static bool IsUploadDocumentUri(
Uri _uri_
)
public:
static bool IsUploadDocumentUri(
System::Uri^ _uri_
)
public static boolean isUploadDocumentUri(URI uri)
def IsUploadDocumentUri(self,uri):
Parameters
Return Value
true if the URL points to a special LEAD cache scheme; otherwise, false.
Remarks
This is a helper method that can be used to detect whether a URL was created by BeginUpload. The Document Library creates a URI in the following format for uploaded documents:
For instance, for the document with ID 2E478C12F7B64B67883B76B4D2FBE612
the cache URI for it will be:
leadcache://2E478C12F7B64B67883B76B4D2FBE612
Use the IsLeadCacheScheme helper method to determine if a string value contains a valid LEAD cache URI. For example:
C#
// A valid LEAD cache scheme with an ID
Assert.IsTrue(DocumentFactory.IsLeadCacheScheme("leadcache://2E478C12F7B64B67883B76B4D2FBE612"));
// An invalid LEAD cache scheme, not leadcache
Assert.IsFalse(DocumentFactory.IsLeadCacheScheme("http://2E478C12F7B64B67883B76B4D2FBE612"));
// Another invalid LEAD cache scheme, does not have a scheme
Assert.IsFalse(DocumentFactory.IsLeadCacheScheme("2E478C12F7B64B67883B76B4D2FBE612"));
Use the MakeLeadCacheUri helper method to construct a LEAD cache URI from a document ID. For example:
C#
Uri documentCacheUri = DocumentFactory.MakeLeadCacheUri("2E478C12F7B64B67883B76B4D2FBE612");
Assert.AreEqual("leadcache://2E478C12F7B64B67883B76B4D2FBE612", documentCacheUri.ToString());
Use the GetLeadCacheData helper method to retrieve the document ID from a LEAD cache URI. For example:
C#
Uri documentCacheUri = DocumentFactory.MakeLeadCacheUri("2E478C12F7B64B67883B76B4D2FBE612");
Assert.AreEqual("2E478C12F7B64B67883B76B4D2FBE612", DocumentFactory.GetLeadCacheData(documentCacheUri));