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
- EndpointAddressMessageFilter.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- ApplicationServiceManager.cs
- FixUpCollection.cs
- AssemblyBuilderData.cs
- SqlCachedBuffer.cs
- SchemaCollectionPreprocessor.cs
- SeverityFilter.cs
- Util.cs
- ItemList.cs
- LoginUtil.cs
- ImageClickEventArgs.cs
- LOSFormatter.cs
- CodeCommentStatementCollection.cs
- CodeRegionDirective.cs
- sitestring.cs
- QueryTask.cs
- CacheHelper.cs
- MsmqIntegrationElement.cs
- RefType.cs
- StyleXamlTreeBuilder.cs
- Graphics.cs
- ConstraintCollection.cs
- PartialList.cs
- ContentAlignmentEditor.cs
- RegexCharClass.cs
- PngBitmapDecoder.cs
- RenderingEventArgs.cs
- ColorTransformHelper.cs
- _StreamFramer.cs
- XhtmlBasicLiteralTextAdapter.cs
- ContainerControl.cs
- ByteStack.cs
- DocumentViewerHelper.cs
- SystemSounds.cs
- AudioLevelUpdatedEventArgs.cs
- TextRunProperties.cs
- MaxMessageSizeStream.cs
- Membership.cs
- TextParagraph.cs
- AddingNewEventArgs.cs
- DynamicRenderer.cs
- ShapingWorkspace.cs
- AppSecurityManager.cs
- ResourceAttributes.cs
- MessageEnumerator.cs
- PageContent.cs
- EncodingTable.cs
- DynamicValueConverter.cs
- _AutoWebProxyScriptHelper.cs
- ProxyRpc.cs
- ParameterDataSourceExpression.cs
- Queue.cs
- BindStream.cs
- ResetableIterator.cs
- PersistChildrenAttribute.cs
- TrustLevelCollection.cs
- SmtpFailedRecipientException.cs
- XslTransform.cs
- ObjectDisposedException.cs
- Typeface.cs
- CodeTypeConstructor.cs
- Delay.cs
- ItemsChangedEventArgs.cs
- AsymmetricKeyExchangeDeformatter.cs
- EventRouteFactory.cs
- COM2EnumConverter.cs
- DelegatedStream.cs
- AttributeQuery.cs
- ArglessEventHandlerProxy.cs
- ImplicitInputBrush.cs
- PointF.cs
- NativeWindow.cs
- Drawing.cs
- CannotUnloadAppDomainException.cs
- ResponseStream.cs
- ConstrainedGroup.cs
- LiteralDesigner.cs
- IisTraceListener.cs
- RotateTransform3D.cs
- FormatVersion.cs
- HtmlInputImage.cs
- LayoutTable.cs
- QuotedStringFormatReader.cs
- Container.cs
- _ConnectionGroup.cs
- SmiEventSink_DeferedProcessing.cs
- CodeTypeOfExpression.cs
- SymLanguageType.cs
- ExtensionFile.cs
- ScrollBarAutomationPeer.cs
- FilterUserControlBase.cs
- DataListCommandEventArgs.cs
- DataGridViewColumnConverter.cs
- FacetDescription.cs
- PostBackTrigger.cs
- XmlQualifiedNameTest.cs
- InstanceLockQueryResult.cs
- SqlConnectionString.cs
- SamlDelegatingWriter.cs