Esempio n. 1
0
        /// <summary>
        /// Gets the URL of a document from its ID
        /// </summary>
        /// <param name="site">The SPSite that the document is part of</param>
        /// <param name="documentId">The ID of the document to retrieve</param>
        /// <returns></returns>
        private string GetDocumentUrlFromId(SPSite site, string documentId)
        {
            string documentUrl = string.Empty;

            try
            {
                // Use the DocumentIdProvider of the site to retrieve the document URL
                DocumentIdProvider provider = DocumentId.GetProvider(site);
                string[]           match    = provider.GetDocumentUrlsById(site, documentId);
                if (match.Length > 0)
                {
                    documentUrl = match[0];
                }
            }
            catch (Exception e)
            {
                Util.LogError(String.Format("The document id service was unable to find a document for the id {0}", documentId));
            }
            return(documentUrl);
        }