Does anyone know how to create cutom search function in new desktop ?
The custom search will be simliar to right pane search, as attached photo.
The current M-Files Desktop Version Number: 22.12.12140.4
Does anyone know how to create cutom search function in new desktop ?
The custom search will be simliar to right pane search, as attached photo.
The current M-Files Desktop Version Number: 22.12.12140.4
You don't create a "VaultViewOperations" instance. You use the instance from your local vault reference (e.g. "dashboard.Vault.ViewOperations.AddTemporarySearchViewEx..").
Thanks Craig Hawker, i can create the temporary search view now, but when i call shellFrame.NavigateToFolder, it show "Folder 'M:\Sample Vault\Test View' no longer exists" error msg
Show your code maybe?
Here is the view created
var oView = new MFiles.View(); oView.Name = "Test View"; //Create the search criteria for the view. var oSc = new MFiles.SearchCriteria(); oSc.FullTextSearchString = "demo*"; oSc.FullTextSearchFlags = (MFiles.MFFullTextSearchFlags.MFFullTextSearchFlagsStemming | MFiles.MFFullTextSearchFlags.MFFullTextSearchFlagsLookInMetaData | MFiles.MFFullTextSearchFlags.MFFullTextSearchFlagsLookInFileData | MFiles.MFFullTextSearchFlags.MFFullTextSearchFlagsTypeAllWords); oSc.SearchFlags = MFiles.MFSearchFlags.MFSearchFlagNone; oSc.ExpandUI = true; //Create search conditions for the view: object status is not deleted var oExpression = new MFiles.Expression(); oExpression.DataStatusValueType = MFiles.MFStatusType.MFStatusTypeDeleted; oExpression.DataStatusValueDataFunction = MFiles.MFDataFunction.MFDataFunctionNoOp; var oTypedValue = new MFiles.TypedValue(); oTypedValue.SetValue(MFDataType.MFDatatypeBoolean, false); var oDeletedEx = new MFiles.SearchConditionEx(); oDeletedEx.SearchCondition.Set(oExpression, MFiles.MFConditionType.MFConditionTypeEqual, oTypedValue); oDeletedEx.Enabled = true; oDeletedEx.Ignored = false; oDeletedEx.SpecialNULL = false; oSc.AdditionalConditions.Add(-1, oDeletedEx); oView = dashboard.Vault.ViewOperations.AddTemporarySearchViewEx(oView, oSc, true); shellFrame.ShowMessage("View created: " + oView.ID + " " + oView.Name + " " + oView.GUID + " " + oView.Visible);
Here is navigate to the view, and the <param> is from created view ID
var fd = new MFiles.FolderDef(); fd.SetView(param); var fds = new MFiles.FolderDefs(); fds.Add(0,fd); shellFrame.NavigateToFolder(fds);
At least in the desktop client temporary searches are within the "latest searches" built-in view, so my guess is that you need to ensure that your folderdefs replicate that:
var fd1 = new MFiles.FolderDef(); fd1.SetView(MFBuiltInView.MFBuiltInViewLatestSearches); // May need to pass 11 instead var fd = new MFiles.FolderDef(); fd.SetView(param); var fds = new MFiles.FolderDefs(); fds.Add(0,fd1); // First "latest searches" fds.Add(0,fd); // Then the temporary view itself. shellFrame.NavigateToFolder(fds);