public Document ImportDocumentAsNewVersion(Document doc, Stream contentStream, String mimeType, GenericOptions checkinOptions)
        {
            Feed <OutlineAtomContent>          versions = doc.GetAllVersions <OutlineAtomContent>(null);
            List <Entry <OutlineAtomContent> > entries  = versions.Entries;

            // If the document is not already checked out, check it out.
            if (!doc.IsCheckedOut())
            {
                doc = doc.Checkout();
            }
            Document checkinDoc = NewDocument(doc.GetPropertyValue("object_name").ToString());

            if (!checkinOptions.ContainsParam("format"))
            {
                checkinOptions.SetQuery("format", doc.GetPropertyValue("a_content_type"));
            }
            if (!checkinOptions.ContainsParam("page"))
            {
                checkinOptions.SetQuery("page", 0);
            }
            if (!checkinOptions.ContainsParam("primary"))
            {
                checkinOptions.SetQuery("primary", true);
            }

            return(doc.CheckinMinor(doc, contentStream, mimeType, checkinOptions));
        }
Exemple #2
0
 private void SetMediaUrlPolicy(GenericOptions options)
 {
     if (!options.ContainsParam(MEDIA_URL_POLICY))
     {
         options.SetQuery(MEDIA_URL_POLICY, "all");
     }
 }