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
- UnsafeNetInfoNativeMethods.cs
- MessageDescriptionCollection.cs
- PagedDataSource.cs
- ProcessInputEventArgs.cs
- AsyncInvokeOperation.cs
- ScriptControlDescriptor.cs
- WebPartTransformerCollection.cs
- QilTargetType.cs
- SizeConverter.cs
- EmptyQuery.cs
- GridLength.cs
- _NTAuthentication.cs
- MetadataArtifactLoaderComposite.cs
- StructuralObject.cs
- HelpKeywordAttribute.cs
- ByteStreamGeometryContext.cs
- Latin1Encoding.cs
- RijndaelCryptoServiceProvider.cs
- InputLanguageEventArgs.cs
- dataprotectionpermission.cs
- InvokeProviderWrapper.cs
- WebSysDescriptionAttribute.cs
- EventItfInfo.cs
- AggregateNode.cs
- GetWinFXPath.cs
- AppDomainAttributes.cs
- AlternationConverter.cs
- TextEffectCollection.cs
- LinqDataSourceEditData.cs
- SessionStateUtil.cs
- DesignTimeValidationFeature.cs
- PixelFormat.cs
- CircleHotSpot.cs
- XPathPatternBuilder.cs
- CorrelationInitializer.cs
- SchemaTypeEmitter.cs
- ObjectDataSourceFilteringEventArgs.cs
- LoadGrammarCompletedEventArgs.cs
- WindowsAuthenticationEventArgs.cs
- DataProtection.cs
- NavigationService.cs
- BufferedWebEventProvider.cs
- PropertyDescriptorGridEntry.cs
- LinqDataSourceDeleteEventArgs.cs
- DataServiceQueryException.cs
- FontUnit.cs
- SmiEventSink_DeferedProcessing.cs
- BitHelper.cs
- SqlUserDefinedTypeAttribute.cs
- dataobject.cs
- NonParentingControl.cs
- ForwardPositionQuery.cs
- Authorization.cs
- ImportContext.cs
- DesignDataSource.cs
- SubclassTypeValidatorAttribute.cs
- HashSetDebugView.cs
- PartManifestEntry.cs
- BuildProviderAppliesToAttribute.cs
- InheritanceContextHelper.cs
- DateTimeOffsetStorage.cs
- ResourceIDHelper.cs
- PackageStore.cs
- FlowDocumentReader.cs
- SystemColorTracker.cs
- HttpDictionary.cs
- DataRelationPropertyDescriptor.cs
- SmiRecordBuffer.cs
- MimeXmlReflector.cs
- DataPagerField.cs
- PolyQuadraticBezierSegment.cs
- XsltQilFactory.cs
- DrawingCollection.cs
- DbParameterHelper.cs
- GACMembershipCondition.cs
- CacheOutputQuery.cs
- MultipartContentParser.cs
- ListSourceHelper.cs
- Process.cs
- SQLBytes.cs
- DocumentSchemaValidator.cs
- Trustee.cs
- ContextStack.cs
- NavigationWindowAutomationPeer.cs
- ConstraintCollection.cs
- DefaultBinder.cs
- PersonalizableAttribute.cs
- SizeAnimationClockResource.cs
- DataColumnMappingCollection.cs
- ErrorInfoXmlDocument.cs
- XmlHierarchicalEnumerable.cs
- SupportsEventValidationAttribute.cs
- ApplicationServiceManager.cs
- DataSourceProvider.cs
- BindableTemplateBuilder.cs
- FlagsAttribute.cs
- HtmlElementCollection.cs
- FileInfo.cs
- path.cs
- AutoGeneratedField.cs