asked on June 20, 2017
•
Show version history
I am leveraging this code to do as it says - create a document/assign a template:
All seems to work fine. What I'd like to do is return the 'Entry ID' of this newly created document. The only way I can determine how this might be done is to recursively go thru the contents of a folder looking for the document with the document name I care about - certainly this isn't the only way... is it?
private void GetAllDocuments(Session session) { string myFolder = @"Laserfiche\z_Training Manual"; string searchParameters = String.Format("{{LF:Lookin=\"{0}\"}}", myFolder); Search lfSearch = new Search(session, searchParameters); SearchListingSettings settings = new SearchListingSettings(); settings.AddColumn(SystemColumn.Id); lfSearch.Run(); SearchResultListing searchResults = lfSearch.GetResultListing(settings); foreach (EntryListingRow item in searchResults) { Int32 docId = (Int32)item[SystemColumn.Id]; //Console.Write(docId); //DocumentInfo docInfo = new DocumentInfo(docId, session); EntryInfo entryInfo = Entry.GetEntryInfo(docId, session); if (entryInfo.EntryType == EntryType.Shortcut) entryInfo = Entry.GetEntryInfo(((ShortcutInfo)entryInfo).TargetId, session); // Now entry should be the DocumentInfo if (entryInfo.EntryType == EntryType.Document) { DocumentInfo docInfo = (DocumentInfo)entryInfo; // check for docInfo.Name match? } } }
0
0