Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Activities / Role / DirectoryLocalQuery.cs / 1305376 / DirectoryLocalQuery.cs
#region Using directives using System; using System.Collections.Generic; using System.Text; using System.DirectoryServices; #endregion namespace System.Workflow.Activities { [Serializable] sealed internal class DirectoryLocalQuery : IDirectoryOperation { internal String m_name; internal String m_value; internal DirectoryQueryOperation m_operation; public DirectoryLocalQuery(String name, String value, DirectoryQueryOperation operation) { if (name == null) throw new ArgumentNullException("name"); if (value == null) throw new ArgumentNullException("value"); this.m_name = name; this.m_value = value; this.m_operation = operation; } public void GetResult(DirectoryEntry rootEntry, DirectoryEntry currentEntry, Listresponse) { if (rootEntry == null) throw new ArgumentNullException("rootEntry"); if (currentEntry == null) throw new ArgumentNullException("currentEntry"); if (response == null) throw new ArgumentNullException("response"); using (DirectorySearcher searcher = new DirectorySearcher(currentEntry)) { String strStart = "("; String strOperation = ""; String strEnd = ")"; switch (this.m_operation) { case DirectoryQueryOperation.Equal: strOperation = "="; break; case DirectoryQueryOperation.NotEqual: strStart = "(!("; strOperation = "="; strEnd = "))"; break; default: System.Diagnostics.Debug.Assert(false); break; } searcher.Filter = strStart + this.m_name + strOperation + this.m_value + strEnd; foreach (SearchResult result in searcher.FindAll()) { response.Add(result.GetDirectoryEntry()); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. #region Using directives using System; using System.Collections.Generic; using System.Text; using System.DirectoryServices; #endregion namespace System.Workflow.Activities { [Serializable] sealed internal class DirectoryLocalQuery : IDirectoryOperation { internal String m_name; internal String m_value; internal DirectoryQueryOperation m_operation; public DirectoryLocalQuery(String name, String value, DirectoryQueryOperation operation) { if (name == null) throw new ArgumentNullException("name"); if (value == null) throw new ArgumentNullException("value"); this.m_name = name; this.m_value = value; this.m_operation = operation; } public void GetResult(DirectoryEntry rootEntry, DirectoryEntry currentEntry, List response) { if (rootEntry == null) throw new ArgumentNullException("rootEntry"); if (currentEntry == null) throw new ArgumentNullException("currentEntry"); if (response == null) throw new ArgumentNullException("response"); using (DirectorySearcher searcher = new DirectorySearcher(currentEntry)) { String strStart = "("; String strOperation = ""; String strEnd = ")"; switch (this.m_operation) { case DirectoryQueryOperation.Equal: strOperation = "="; break; case DirectoryQueryOperation.NotEqual: strStart = "(!("; strOperation = "="; strEnd = "))"; break; default: System.Diagnostics.Debug.Assert(false); break; } searcher.Filter = strStart + this.m_name + strOperation + this.m_value + strEnd; foreach (SearchResult result in searcher.FindAll()) { response.Add(result.GetDirectoryEntry()); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlTypeMapping.cs
- EntityDataSourceContainerNameConverter.cs
- storepermission.cs
- ModulesEntry.cs
- ConfigurationConverterBase.cs
- AutoSizeToolBoxItem.cs
- ColorConvertedBitmap.cs
- InfiniteTimeSpanConverter.cs
- ProjectionCamera.cs
- XmlDeclaration.cs
- HttpTransportElement.cs
- RemotingException.cs
- TextBoxRenderer.cs
- recordstatefactory.cs
- Table.cs
- externdll.cs
- DesignerRegion.cs
- WebPartAddingEventArgs.cs
- FieldToken.cs
- StyleCollection.cs
- SqlDependencyUtils.cs
- RemotingServices.cs
- SHA256.cs
- EDesignUtil.cs
- ConstraintCollection.cs
- TriggerBase.cs
- LockRecursionException.cs
- StoryFragments.cs
- Int32RectConverter.cs
- OutOfMemoryException.cs
- InteropEnvironment.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- ProgressBarHighlightConverter.cs
- VarRemapper.cs
- TagNameToTypeMapper.cs
- SelectingProviderEventArgs.cs
- EventLogPermission.cs
- ColorTransform.cs
- OutputWindow.cs
- ExecutionProperties.cs
- XmlEncodedRawTextWriter.cs
- RequestCacheValidator.cs
- AutomationElementCollection.cs
- WebPartTransformerAttribute.cs
- ReadOnlyKeyedCollection.cs
- DeviceContexts.cs
- TransformCollection.cs
- Quaternion.cs
- ApplicationHost.cs
- ItemTypeToolStripMenuItem.cs
- SimpleBitVector32.cs
- OAVariantLib.cs
- DescriptionAttribute.cs
- RemotingException.cs
- SystemIPAddressInformation.cs
- SharedPersonalizationStateInfo.cs
- XslVisitor.cs
- PeerFlooder.cs
- CountdownEvent.cs
- TransformerTypeCollection.cs
- MatrixAnimationUsingKeyFrames.cs
- RegistryExceptionHelper.cs
- ToolStripActionList.cs
- WebBrowserDesigner.cs
- StrokeSerializer.cs
- Tracer.cs
- WindowPattern.cs
- TextEditorLists.cs
- Utility.cs
- AppDomainUnloadedException.cs
- DataSet.cs
- GcHandle.cs
- SurrogateEncoder.cs
- unsafeIndexingFilterStream.cs
- CustomSignedXml.cs
- EntryWrittenEventArgs.cs
- RtfToXamlReader.cs
- SurrogateEncoder.cs
- ObjectHelper.cs
- PopupRoot.cs
- SmtpSection.cs
- SqlDependencyUtils.cs
- XmlDataSource.cs
- TextSegment.cs
- RotationValidation.cs
- CornerRadius.cs
- DESCryptoServiceProvider.cs
- System.Data_BID.cs
- KoreanCalendar.cs
- FormParameter.cs
- GridViewCommandEventArgs.cs
- DesignDataSource.cs
- SystemThemeKey.cs
- ListViewHitTestInfo.cs
- __ComObject.cs
- NoClickablePointException.cs
- UriTemplateDispatchFormatter.cs
- DesignerDataConnection.cs
- ToolStripDropDownButton.cs
- PointAnimationUsingKeyFrames.cs