public static PropertyValue Create(Vault vault, int propDef, object value) { var mfPropDef = vault.PropertyDefOperations.GetPropertyDef(propDef); var dataType = mfPropDef.DataType; var valueListId = mfPropDef.ValueList; if (valueListId == 0) { return(Create(propDef, dataType, value)); } var mfObjectType = vault.ValueListOperations.GetValueList(valueListId); if (!mfObjectType.RealObjectType) { var str = value as String; if (str != null) { var item = MFSearchConditionUtils.GetValueListItem(vault, valueListId, str); return(Create(propDef, dataType, item.ID)); } } int id = Convert.ToInt32(value); return(Create(propDef, dataType, id)); }
public static string GetSearchView(this Vault vault, string search, bool onlyDoc = true) { var viewName = "搜索:" + search + " - " + DateTime.Now.ToString("yyyyMMddHHmmss"); var oViewNew = new View { Name = viewName }; var searchStr = search ?? String.Empty; if (!String.IsNullOrWhiteSpace(searchStr)) { searchStr += "*"; } else { searchStr = String.Empty; } var oSc = new SearchCriteria { FullTextSearchString = searchStr, FullTextSearchFlags = (MFFullTextSearchFlags.MFFullTextSearchFlagsStemming | MFFullTextSearchFlags.MFFullTextSearchFlagsLookInMetaData | MFFullTextSearchFlags.MFFullTextSearchFlagsLookInFileData | MFFullTextSearchFlags.MFFullTextSearchFlagsTypeAnyWords), SearchFlags = MFSearchFlags.MFSearchFlagNone, ExpandUI = false }; var oExpression = new Expression(); oExpression.DataStatusValueType = MFStatusType.MFStatusTypeDeleted; oExpression.DataStatusValueDataFunction = MFDataFunction.MFDataFunctionNoOp; var oTypedValue = new TypedValue(); oTypedValue.SetValue(MFDataType.MFDatatypeBoolean, false); var oDeletedEx = new SearchConditionEx(); oDeletedEx.SearchCondition.Set(oExpression, MFConditionType.MFConditionTypeEqual, oTypedValue); oDeletedEx.Enabled = true; oDeletedEx.Ignored = false; oDeletedEx.SpecialNULL = false; oSc.AdditionalConditions.Add(-1, oDeletedEx); SearchConditions baseConditions = null; if (onlyDoc) { baseConditions = new SearchConditions(); var objTypeSc = MFSearchConditionUtils.ObjType((int)MFBuiltInObjectType.MFBuiltInObjectTypeDocument); baseConditions.Add(-1, objTypeSc); } var oViewNew1 = vault.ViewOperations.AddTemporarySearchView(oViewNew, oSc, baseConditions); return(vault.ViewOperations.GetViewLocationInClient(oViewNew1.ID)); }
public static ObjectSearchResults GetObjectsCheckedoutByMe(this Vault vault) { var scs = new SearchConditions(); var currentUserId = vault.GetCurrentUserId(); var checkedoutSC = MFSearchConditionUtils.Status(MFConditionType.MFConditionTypeEqual, MFStatusType.MFStatusTypeCheckedOutTo, MFDataType.MFDatatypeLookup, currentUserId); scs.Add(-1, checkedoutSC); return(vault.ObjectSearchOperations.SearchForObjectsByConditions(scs, MFSearchFlags.MFSearchFlagNone, false)); }