示例#1
0
 public void Undelete(string newDN)
 {
     this.Init();
     if (newDN != null)
     {
         if (newDN.Length != 0)
         {
             DebugLogger.WriteLine("ADActiveObject", string.Concat("Undelete ", this._adObject.DistinguishedName, " to ", newDN));
             DirectoryAttributeModification[] directoryAttributeModification = new DirectoryAttributeModification[2];
             directoryAttributeModification[0]      = new DirectoryAttributeModification();
             directoryAttributeModification[0].Name = "distinguishedName";
             directoryAttributeModification[0].Add(newDN);
             directoryAttributeModification[1]           = new DirectoryAttributeModification();
             directoryAttributeModification[1].Name      = "isDeleted";
             directoryAttributeModification[1].Operation = DirectoryAttributeOperation.Delete;
             ADModifyRequest aDModifyRequest = new ADModifyRequest(this._adObject.DistinguishedName, directoryAttributeModification);
             aDModifyRequest.Controls.Add(new PermissiveModifyControl());
             aDModifyRequest.Controls.Add(new ShowDeletedControl());
             this._syncOps.Modify(this._sessionHandle, aDModifyRequest);
             string[] distinguishedName = new string[5];
             distinguishedName[0] = "Undelete ";
             distinguishedName[1] = this._adObject.DistinguishedName;
             distinguishedName[2] = " to ";
             distinguishedName[3] = newDN;
             distinguishedName[4] = " succeeded";
             DebugLogger.WriteLine("ADActiveObject", string.Concat(distinguishedName));
             return;
         }
         else
         {
             throw new ArgumentException(StringResources.EmptyStringParameter, "New DistinguishedName");
         }
     }
     else
     {
         throw new ArgumentNullException("New DistinguishedName");
     }
 }
示例#2
0
		ADModifyResponse Microsoft.ActiveDirectory.Management.IADSyncOperations.Modify(ADSessionHandle handle, ADModifyRequest request)
		{
			ADModifyResponse aDModifyResponse = null;
			AdwsConnection internalHandle = this.GetInternalHandle(handle);
			if (internalHandle != null)
			{
				aDModifyResponse = internalHandle.Modify(request);
				this.CheckAndThrowReferralException(aDModifyResponse);
				ADStoreAccess.ThrowExceptionForResultCodeError(aDModifyResponse.ResultCode, aDModifyResponse.ErrorMessage, null);
			}
			return aDModifyResponse;
		}
        ADModifyResponse Microsoft.ActiveDirectory.Management.IADSyncOperations.Modify(ADSessionHandle handle, ADModifyRequest request)
        {
            ADModifyResponse             aDModifyResponse = null;
            ADDirectoryServiceConnection internalHandle   = this.GetInternalHandle(handle);

            if (internalHandle != null)
            {
                aDModifyResponse = internalHandle.Modify(request);
                this.CheckAndThrowReferralException(aDModifyResponse);
                ADStoreAccess.ThrowExceptionForResultCodeError(aDModifyResponse.ResultCode, aDModifyResponse.ErrorMessage, null);
            }
            return(aDModifyResponse);
        }
 public ADModifyResponse Modify(ADSessionHandle handle, ADModifyRequest request)
 {
     throw new NotImplementedException();
 }
示例#5
0
		public void Update()
		{
			ADPropertyValueCollection value;
			this.Init();
			DebugLogger.WriteLine("ADActiveObject", string.Concat("Update called for ", this._adObject.DistinguishedName));
			DirectoryAttributeModificationCollection directoryAttributeModificationCollection = new DirectoryAttributeModificationCollection();
			if (!this._adObject.TrackChanges)
			{
				bool flag = false;
				foreach (KeyValuePair<string, ADPropertyValueCollection> keyValuePair in this._adObject)
				{
					string key = keyValuePair.Key;
					if (flag || string.Compare(key, "distinguishedName", StringComparison.OrdinalIgnoreCase) != 0)
					{
						value = keyValuePair.Value;
						this.UpdateValueCollectionChanges(key, value, directoryAttributeModificationCollection);
					}
					else
					{
						flag = true;
					}
				}
			}
			else
			{
				foreach (string addedProperty in this._adObject.AddedProperties)
				{
					value = this._adObject[addedProperty];
					this.UpdateValueCollectionChanges(addedProperty, value, directoryAttributeModificationCollection);
				}
				foreach (string removedProperty in this._adObject.RemovedProperties)
				{
					DirectoryAttributeModification directoryAttributeModification = new DirectoryAttributeModification();
					directoryAttributeModification.Name = removedProperty;
					directoryAttributeModification.Operation = DirectoryAttributeOperation.Delete;
					directoryAttributeModificationCollection.Add(directoryAttributeModification);
				}
				foreach (string modifiedProperty in this._adObject.ModifiedProperties)
				{
					value = this._adObject[modifiedProperty];
					this.UpdateValueCollectionChanges(modifiedProperty, value, directoryAttributeModificationCollection);
				}
			}
			if (directoryAttributeModificationCollection.Count != 0)
			{
				DirectoryAttributeModification[] directoryAttributeModificationArray = new DirectoryAttributeModification[directoryAttributeModificationCollection.Count];
				directoryAttributeModificationCollection.CopyTo(directoryAttributeModificationArray, 0);
				ADModifyRequest aDModifyRequest = new ADModifyRequest(this._adObject.DistinguishedName, directoryAttributeModificationArray);
				PermissiveModifyControl permissiveModifyControl = new PermissiveModifyControl();
				aDModifyRequest.Controls.Add(permissiveModifyControl);
				if (this._sdFlags != SecurityMasks.None)
				{
					aDModifyRequest.Controls.Add(new SecurityDescriptorFlagControl(this._sdFlags));
				}
				this._syncOps.Modify(this._sessionHandle, aDModifyRequest);
				DebugLogger.WriteLine("ADActiveObject", string.Concat("Update succeeded for ", this._adObject.DistinguishedName));
				return;
			}
			else
			{
				return;
			}
		}
示例#6
0
		public void Undelete(string newDN)
		{
			this.Init();
			if (newDN != null)
			{
				if (newDN.Length != 0)
				{
					DebugLogger.WriteLine("ADActiveObject", string.Concat("Undelete ", this._adObject.DistinguishedName, " to ", newDN));
					DirectoryAttributeModification[] directoryAttributeModification = new DirectoryAttributeModification[2];
					directoryAttributeModification[0] = new DirectoryAttributeModification();
					directoryAttributeModification[0].Name = "distinguishedName";
					directoryAttributeModification[0].Add(newDN);
					directoryAttributeModification[1] = new DirectoryAttributeModification();
					directoryAttributeModification[1].Name = "isDeleted";
					directoryAttributeModification[1].Operation = DirectoryAttributeOperation.Delete;
					ADModifyRequest aDModifyRequest = new ADModifyRequest(this._adObject.DistinguishedName, directoryAttributeModification);
					aDModifyRequest.Controls.Add(new PermissiveModifyControl());
					aDModifyRequest.Controls.Add(new ShowDeletedControl());
					this._syncOps.Modify(this._sessionHandle, aDModifyRequest);
					string[] distinguishedName = new string[5];
					distinguishedName[0] = "Undelete ";
					distinguishedName[1] = this._adObject.DistinguishedName;
					distinguishedName[2] = " to ";
					distinguishedName[3] = newDN;
					distinguishedName[4] = " succeeded";
					DebugLogger.WriteLine("ADActiveObject", string.Concat(distinguishedName));
					return;
				}
				else
				{
					throw new ArgumentException(StringResources.EmptyStringParameter, "New DistinguishedName");
				}
			}
			else
			{
				throw new ArgumentNullException("New DistinguishedName");
			}
		}
		public ADModifyResponse Modify (ADSessionHandle handle, ADModifyRequest request)
		{
			throw new NotImplementedException ();
		}
示例#8
0
        public void Update()
        {
            ADPropertyValueCollection value;

            this.Init();
            DebugLogger.WriteLine("ADActiveObject", string.Concat("Update called for ", this._adObject.DistinguishedName));
            DirectoryAttributeModificationCollection directoryAttributeModificationCollection = new DirectoryAttributeModificationCollection();

            if (!this._adObject.TrackChanges)
            {
                bool flag = false;
                foreach (KeyValuePair <string, ADPropertyValueCollection> keyValuePair in this._adObject)
                {
                    string key = keyValuePair.Key;
                    if (flag || string.Compare(key, "distinguishedName", StringComparison.OrdinalIgnoreCase) != 0)
                    {
                        value = keyValuePair.Value;
                        this.UpdateValueCollectionChanges(key, value, directoryAttributeModificationCollection);
                    }
                    else
                    {
                        flag = true;
                    }
                }
            }
            else
            {
                foreach (string addedProperty in this._adObject.AddedProperties)
                {
                    value = this._adObject[addedProperty];
                    this.UpdateValueCollectionChanges(addedProperty, value, directoryAttributeModificationCollection);
                }
                foreach (string removedProperty in this._adObject.RemovedProperties)
                {
                    DirectoryAttributeModification directoryAttributeModification = new DirectoryAttributeModification();
                    directoryAttributeModification.Name      = removedProperty;
                    directoryAttributeModification.Operation = DirectoryAttributeOperation.Delete;
                    directoryAttributeModificationCollection.Add(directoryAttributeModification);
                }
                foreach (string modifiedProperty in this._adObject.ModifiedProperties)
                {
                    value = this._adObject[modifiedProperty];
                    this.UpdateValueCollectionChanges(modifiedProperty, value, directoryAttributeModificationCollection);
                }
            }
            if (directoryAttributeModificationCollection.Count != 0)
            {
                DirectoryAttributeModification[] directoryAttributeModificationArray = new DirectoryAttributeModification[directoryAttributeModificationCollection.Count];
                directoryAttributeModificationCollection.CopyTo(directoryAttributeModificationArray, 0);
                ADModifyRequest         aDModifyRequest         = new ADModifyRequest(this._adObject.DistinguishedName, directoryAttributeModificationArray);
                PermissiveModifyControl permissiveModifyControl = new PermissiveModifyControl();
                aDModifyRequest.Controls.Add(permissiveModifyControl);
                if (this._sdFlags != SecurityMasks.None)
                {
                    aDModifyRequest.Controls.Add(new SecurityDescriptorFlagControl(this._sdFlags));
                }
                this._syncOps.Modify(this._sessionHandle, aDModifyRequest);
                DebugLogger.WriteLine("ADActiveObject", string.Concat("Update succeeded for ", this._adObject.DistinguishedName));
                return;
            }
            else
            {
                return;
            }
        }