diff --git a/SoObjects/SOGo/SOGoFolder.h b/SoObjects/SOGo/SOGoFolder.h index 50c9f8e42..e768cd22d 100644 --- a/SoObjects/SOGo/SOGoFolder.h +++ b/SoObjects/SOGo/SOGoFolder.h @@ -55,6 +55,8 @@ - (GCSFolder *)ocsFolder; /* lower level fetches */ +- (BOOL) nameExistsInFolder: (NSString *) objectName; + - (NSArray *)fetchContentObjectNames; - (NSDictionary *)fetchContentStringsAndNamesOfAllObjects; diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m index 27eabccae..d7fe67b6f 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoFolder.m @@ -142,6 +142,23 @@ return [records valueForKey:@"c_name"]; } +- (BOOL) nameExistsInFolder: (NSString *) objectName +{ + NSArray *fields, *records; + EOQualifier *qualifier; + + qualifier + = [EOQualifier qualifierWithQualifierFormat: + [NSString stringWithFormat: @"c_name='%@'", objectName]]; + + fields = [NSArray arrayWithObject: @"c_name"]; + records = [[self ocsFolder] fetchFields: fields + matchingQualifier: qualifier]; + return (records + && ![records isKindOfClass:[NSException class]] + && [records count] > 0); +} + - (NSDictionary *)fetchContentStringsAndNamesOfAllObjects { NSDictionary *files;