Is() public method

Determines if the 'name' matches this ObjectClass.
public Is ( String name ) : bool
name String case-insensitive string representation of the ObjectClass's /// type.
return bool
        /// <summary>
        /// Implementation of CreateOp.Create
        /// </summary>
        /// <param name="oclass">Object class</param>(oc
        /// <param name="attributes">Object attributes</param>
        /// <param name="options">Operation options</param>
        /// <returns><see cref="Uid"/> of the created object</returns>
        public override Uid Create(
            ObjectClass oclass,
            ICollection<ConnectorAttribute> attributes,
            OperationOptions options)
        {
            const string METHOD = "Create";
            Debug.WriteLine(METHOD + ":entry", ClassName);

            // first create the object in AD
            Uid uid = base.Create(oclass, attributes, options);

            try
            {
                if (oclass.Is(MailboxName))
                {
                    // enable mailbox for person
                    Command cmd = ExchangeUtility.GetCommand(CommandInfo.EnableMailbox, attributes, this.configuration);
                    this.runspace.InvokePipeline(cmd);
                }
                else if (oclass.Is(MailUserName))
                {
                    // enable mailuser
                    Command cmd = ExchangeUtility.GetCommand(CommandInfo.EnableMailUser, attributes, this.configuration);
                    this.runspace.InvokePipeline(cmd);
                }

                Debug.WriteLine(METHOD + ":exit", ClassName);
            }
            catch
            {
                // do the rollback - delete the object by uid
                // no need to check the uid is null, ensured by the create contract
                this.Delete(oclass, uid, options);
                throw;
            }

            return uid;
        }
Ejemplo n.º 2
0
 internal bool IsRelevantFor(ObjectClass objectClass)
 {
     if (ObjectType == null || ObjectType.Length == 0)
     {
         return true;
     }
     else
     {
         foreach (string objectTypeName in ObjectType)
         {
             if (objectClass.Is(objectTypeName))
             {
                 return true;
             }
         }
     }
     return false;
 }