Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Activities / Role / DirectoryRootQuery.cs / 1305376 / DirectoryRootQuery.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 DirectoryRootQuery : IDirectoryOperation { private String m_name; private String m_value; private DirectoryQueryOperation m_operation; public DirectoryRootQuery(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(rootEntry)) { 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 DirectoryRootQuery : IDirectoryOperation { private String m_name; private String m_value; private DirectoryQueryOperation m_operation; public DirectoryRootQuery(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(rootEntry)) { 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
- ComboBoxRenderer.cs
- SqlDataReader.cs
- InternalPermissions.cs
- ThreadStaticAttribute.cs
- ActiveXHost.cs
- ProxyElement.cs
- TemplateContentLoader.cs
- XmlSchemaAll.cs
- XmlSchemaAll.cs
- HandlerBase.cs
- SystemInfo.cs
- BuildProvider.cs
- ZoneLinkButton.cs
- PropertyMapper.cs
- RelationshipConverter.cs
- WorkflowOperationAsyncResult.cs
- PublishLicense.cs
- RegisteredHiddenField.cs
- TextRunCacheImp.cs
- MailWriter.cs
- SerializationSectionGroup.cs
- TimeStampChecker.cs
- SqlBulkCopyColumnMapping.cs
- DynamicDataRouteHandler.cs
- HMACRIPEMD160.cs
- Pair.cs
- IxmlLineInfo.cs
- BooleanKeyFrameCollection.cs
- CallbackHandler.cs
- ViewLoader.cs
- ListViewPagedDataSource.cs
- VerticalAlignConverter.cs
- PropertySourceInfo.cs
- Options.cs
- DataSourceCacheDurationConverter.cs
- ThaiBuddhistCalendar.cs
- StringPropertyBuilder.cs
- ExternalException.cs
- TimeSpanMinutesConverter.cs
- PostBackOptions.cs
- TransformerConfigurationWizardBase.cs
- ProtocolsConfigurationEntry.cs
- AudioFormatConverter.cs
- ActivityDesignerHelper.cs
- AutomationElementIdentifiers.cs
- VoiceChangeEventArgs.cs
- ConfigurationSettings.cs
- HandlerBase.cs
- PerformanceCounterLib.cs
- BuildManager.cs
- ExpressionBuilderContext.cs
- TextLine.cs
- ActivityAction.cs
- StaticTextPointer.cs
- UriPrefixTable.cs
- FixedPageAutomationPeer.cs
- GeometryHitTestParameters.cs
- Lease.cs
- SecurityToken.cs
- Walker.cs
- XmlSchemaParticle.cs
- EncryptedKey.cs
- SqlFacetAttribute.cs
- StructuredTypeInfo.cs
- IncrementalReadDecoders.cs
- DefaultValidator.cs
- DetailsViewModeEventArgs.cs
- Win32Exception.cs
- GradientBrush.cs
- PKCS1MaskGenerationMethod.cs
- InvokePatternIdentifiers.cs
- KeyBinding.cs
- Crypto.cs
- FilterQueryOptionExpression.cs
- ISO2022Encoding.cs
- CheckBoxFlatAdapter.cs
- DNS.cs
- TextEditorSelection.cs
- EditorZoneBase.cs
- Attribute.cs
- ipaddressinformationcollection.cs
- HttpsHostedTransportConfiguration.cs
- WindowVisualStateTracker.cs
- SecurityDocument.cs
- ZipIORawDataFileBlock.cs
- BitmapInitialize.cs
- Font.cs
- ActivationArguments.cs
- LockRecoveryTask.cs
- HostingPreferredMapPath.cs
- FileSecurity.cs
- WindowsToolbarAsMenu.cs
- EncodingTable.cs
- NetTcpSecurity.cs
- DataGrid.cs
- ComponentManagerBroker.cs
- ByteAnimationBase.cs
- DesignerOptionService.cs
- ObfuscationAttribute.cs
- XmlSchemaFacet.cs