Hi, everybody
I could not run the searchtoken Historyafter&Historybefore method in the code I shared.
“Date_Before & Date_After” type is “05.07.2021 00:00:00”
@AmenJlili I’m able to get search results in the API, however they don’t really make sense so I went into the actual PDM tool and started messing with the History tab and the built in tools for the date before/after. I cannot for the life of me get anything that makes sense. I choose “Stored After Jul 5, 2021” and the entire list is legacy files that haven’t been touched since 2008 - 2011.
Unless I’m misunderstanding how the search is supposed to work, this appears broken.
Edit: I’ll leave the above, however I discovered that you have to search for ‘*’ in the “Text to find in history” or else it won’t work.
Edit2: The wildcard ‘*’ doesn’t seem to work for me when I set the
Additionally, regardless of the date format I put in (OA Date, DateTime, raw String, etc.) I can’t get the search to limit my results to what I’m looking for.
[PDMTestMethod]
public void GetHistory()
{
var now = DateTime.Now.ToOADate();
var yesterday = DateTime.Today.Subtract(TimeSpan.FromDays(5)).ToOADate();
IEdmSearch6 search = (IEdmSearch6)(Vault as IEdmVault7).CreateUtility(EdmUtility.EdmUtil_Search);
search.SetToken(EdmSearchToken.Edmstok_HistoryAfter, yesterday);
search.SetToken(EdmSearchToken.Edmstok_HistoryBefore, now);
search.SetToken(EdmSearchToken.Edmstok_FindFiles, true);
search.SetToken(EdmSearchToken.Edmstok_HistoryString, "%.sldprt");
var result = search.GetFirstResult();
while (result != null)
{
var file = Vault.GetObject(result.ObjectType, result.ID) as IEdmFile5;
Console.WriteLine($"{file.Name.PadRight(30)} {file.GetLocalFileDate(file.GetParentFolderID())}");
result = search.GetNextResult();
}
}