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
- SByte.cs
- ConfigurationLocation.cs
- TimeZone.cs
- WorkflowInstanceSuspendedRecord.cs
- CellTreeSimplifier.cs
- UnsafeNativeMethods.cs
- NameSpaceEvent.cs
- BufferBuilder.cs
- XsltArgumentList.cs
- AutomationPattern.cs
- TypeDescriptor.cs
- DrawingGroup.cs
- SrgsDocument.cs
- ChtmlTextBoxAdapter.cs
- ResourceType.cs
- SemanticBasicElement.cs
- ADMembershipProvider.cs
- ContextMenuService.cs
- ReadOnlyHierarchicalDataSourceView.cs
- CellConstant.cs
- externdll.cs
- Logging.cs
- TitleStyle.cs
- UnsafeNetInfoNativeMethods.cs
- DBNull.cs
- CharacterMetricsDictionary.cs
- SQLInt64Storage.cs
- RuntimeConfigurationRecord.cs
- OptimizedTemplateContent.cs
- AccessControlEntry.cs
- GenericAuthenticationEventArgs.cs
- CurrentChangingEventManager.cs
- ScriptManager.cs
- MembershipSection.cs
- NetMsmqBindingElement.cs
- DrawingCollection.cs
- TaskFileService.cs
- NumericUpDownAccelerationCollection.cs
- Symbol.cs
- GridViewRow.cs
- DataGridViewCellErrorTextNeededEventArgs.cs
- CombinedHttpChannel.cs
- EntityConnectionStringBuilder.cs
- HttpPostProtocolReflector.cs
- SymbolEqualComparer.cs
- DefaultBinder.cs
- DataTemplateKey.cs
- XamlUtilities.cs
- TablePatternIdentifiers.cs
- UrlPath.cs
- XmlAnyElementAttribute.cs
- ExceptionRoutedEventArgs.cs
- WebBrowserPermission.cs
- querybuilder.cs
- LinqDataSourceContextData.cs
- StructuredTypeEmitter.cs
- _DigestClient.cs
- HtmlTextViewAdapter.cs
- FormParameter.cs
- AssemblyCollection.cs
- BulletDecorator.cs
- ParagraphVisual.cs
- Helpers.cs
- ConsumerConnectionPointCollection.cs
- ServiceHttpHandlerFactory.cs
- XPathItem.cs
- AllMembershipCondition.cs
- EndOfStreamException.cs
- SqlTriggerAttribute.cs
- ErrorFormatterPage.cs
- EventLogEntryCollection.cs
- WmpBitmapDecoder.cs
- RenderOptions.cs
- GraphicsState.cs
- SafeNativeMethods.cs
- DiscoveryClientChannelBase.cs
- LabelDesigner.cs
- CapabilitiesUse.cs
- RoleGroupCollection.cs
- StyleXamlParser.cs
- MDIClient.cs
- ItemsControl.cs
- URLIdentityPermission.cs
- BitmapCacheBrush.cs
- IteratorDescriptor.cs
- LinqDataSourceValidationException.cs
- ThreadAttributes.cs
- GridItemProviderWrapper.cs
- IncrementalHitTester.cs
- ExpanderAutomationPeer.cs
- input.cs
- XmlDocumentFieldSchema.cs
- HtmlTableCellCollection.cs
- FormatSettings.cs
- CodeValidator.cs
- ImageKeyConverter.cs
- MessageBox.cs
- WorkflowViewManager.cs
- ListDictionary.cs
- SourceFileBuildProvider.cs