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
- PerspectiveCamera.cs
- RuleInfoComparer.cs
- ParseChildrenAsPropertiesAttribute.cs
- DrawListViewItemEventArgs.cs
- XamlStream.cs
- Int16KeyFrameCollection.cs
- TrustSection.cs
- PropertyIDSet.cs
- DbMetaDataCollectionNames.cs
- documentsequencetextcontainer.cs
- QuestionEventArgs.cs
- SiteMapDataSourceDesigner.cs
- WindowShowOrOpenTracker.cs
- PopupRoot.cs
- MultiPropertyDescriptorGridEntry.cs
- DataMember.cs
- ContextActivityUtils.cs
- BaseCollection.cs
- ConditionCollection.cs
- Calendar.cs
- EnlistmentTraceIdentifier.cs
- ToolStripItemRenderEventArgs.cs
- DispatcherTimer.cs
- FrameworkElementAutomationPeer.cs
- TypeConverterHelper.cs
- Converter.cs
- ImageListStreamer.cs
- BindableTemplateBuilder.cs
- BaseCollection.cs
- GridViewUpdateEventArgs.cs
- CodeMethodReturnStatement.cs
- ProtocolsConfigurationEntry.cs
- TypeLoadException.cs
- DataPointer.cs
- Point3DKeyFrameCollection.cs
- SqlTransaction.cs
- DbConnectionStringCommon.cs
- HealthMonitoringSectionHelper.cs
- BasicAsyncResult.cs
- ResourceContainer.cs
- SqlParameterCollection.cs
- FormsAuthenticationUserCollection.cs
- UnsignedPublishLicense.cs
- ListViewItem.cs
- AddressHeaderCollectionElement.cs
- DirectoryObjectSecurity.cs
- FixedSchema.cs
- XsdDataContractImporter.cs
- WebBrowser.cs
- MiniLockedBorderGlyph.cs
- MultiPartWriter.cs
- WS2007HttpBindingElement.cs
- HttpRequest.cs
- _ListenerAsyncResult.cs
- SqlBulkCopyColumnMappingCollection.cs
- InternalBase.cs
- SystemFonts.cs
- CommonRemoteMemoryBlock.cs
- IndependentlyAnimatedPropertyMetadata.cs
- EventSetter.cs
- ActivityDesignerResources.cs
- ExpressionNormalizer.cs
- XmlDownloadManager.cs
- ReadOnlyDictionary.cs
- TableRowGroup.cs
- FormViewDeletedEventArgs.cs
- ReliableSessionElement.cs
- ListItemParagraph.cs
- Pair.cs
- TransactedBatchContext.cs
- SQLByte.cs
- OptimizerPatterns.cs
- EastAsianLunisolarCalendar.cs
- DataViewSettingCollection.cs
- EmptyEnumerator.cs
- BitmapEffectDrawingContextState.cs
- AsynchronousChannelMergeEnumerator.cs
- ReservationCollection.cs
- ManipulationBoundaryFeedbackEventArgs.cs
- EventHandlersStore.cs
- CompositeTypefaceMetrics.cs
- OrderPreservingSpoolingTask.cs
- CmsInterop.cs
- StoryFragments.cs
- WebControlParameterProxy.cs
- ResourcesChangeInfo.cs
- CodeMemberProperty.cs
- Shape.cs
- SrgsItemList.cs
- DocumentPageTextView.cs
- ClassHandlersStore.cs
- XMLSyntaxException.cs
- TextDecorationCollectionConverter.cs
- ApplicationServiceManager.cs
- DataRecordInfo.cs
- CancelEventArgs.cs
- DebugView.cs
- HttpChannelHelper.cs
- UIElement.cs
- IUnknownConstantAttribute.cs