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
- Profiler.cs
- ToolboxItemFilterAttribute.cs
- Shape.cs
- StandardOleMarshalObject.cs
- WindowsClaimSet.cs
- HttpModuleActionCollection.cs
- SettingsPropertyValueCollection.cs
- HtmlCommandAdapter.cs
- XslTransform.cs
- SerializationFieldInfo.cs
- SystemFonts.cs
- WinInetCache.cs
- DecoderFallbackWithFailureFlag.cs
- IndividualDeviceConfig.cs
- ButtonChrome.cs
- LocalValueEnumerator.cs
- InvalidOperationException.cs
- BaseTemplatedMobileComponentEditor.cs
- SmiSettersStream.cs
- RangeValidator.cs
- GatewayDefinition.cs
- SqlDataSourceCustomCommandEditor.cs
- mediaeventshelper.cs
- NativeConfigurationLoader.cs
- KeyFrames.cs
- DataGridViewColumnDesigner.cs
- DbParameterHelper.cs
- LogConverter.cs
- CheckBox.cs
- ListViewTableRow.cs
- DatePickerTextBox.cs
- DataViewManager.cs
- SafeJobHandle.cs
- AndCondition.cs
- CompilerErrorCollection.cs
- FileDialogPermission.cs
- MessageFormatterConverter.cs
- SmtpNtlmAuthenticationModule.cs
- ACE.cs
- XmlILStorageConverter.cs
- TdsParserStaticMethods.cs
- ProvidePropertyAttribute.cs
- BCryptNative.cs
- FlowDocumentPaginator.cs
- ScriptingScriptResourceHandlerSection.cs
- ExtendedPropertyInfo.cs
- DictionaryEntry.cs
- ExceptionUtil.cs
- CapabilitiesUse.cs
- FamilyMapCollection.cs
- ReadOnlyAttribute.cs
- DataGridTable.cs
- XPathDocumentIterator.cs
- IPAddress.cs
- ModelItemKeyValuePair.cs
- WebPartConnectionsCloseVerb.cs
- SafeNativeMethods.cs
- SizeValueSerializer.cs
- ViewCellSlot.cs
- CodeComment.cs
- SignatureConfirmationElement.cs
- DataTableMappingCollection.cs
- AttributeUsageAttribute.cs
- TextViewElement.cs
- DurableInstanceProvider.cs
- URLAttribute.cs
- MSHTMLHost.cs
- TransformerInfo.cs
- PieceNameHelper.cs
- IIS7WorkerRequest.cs
- ServiceHttpHandlerFactory.cs
- MdiWindowListStrip.cs
- CommandHelpers.cs
- RetrieveVirtualItemEventArgs.cs
- Setter.cs
- PermissionRequestEvidence.cs
- Int16Converter.cs
- AxisAngleRotation3D.cs
- LinqDataSourceStatusEventArgs.cs
- DbQueryCommandTree.cs
- SafeIUnknown.cs
- ReferentialConstraint.cs
- OdbcEnvironmentHandle.cs
- RichTextBox.cs
- HotSpot.cs
- SerialReceived.cs
- XmlTypeMapping.cs
- EndpointDesigner.cs
- ServicePointManagerElement.cs
- ButtonChrome.cs
- InternalPermissions.cs
- HtmlMeta.cs
- ElementHostPropertyMap.cs
- SoapAttributeAttribute.cs
- ListControlBuilder.cs
- CodeDelegateCreateExpression.cs
- ChannelEndpointElement.cs
- IPAddress.cs
- Vars.cs
- LineServices.cs