System.DirectoryServices Namespace

https://docs.microsoft.com/en-us/dotnet/api/system.directoryservices?view=netframework-4.7

The System.DirectoryServices namespace provides easy access to Active Directory Domain Services from managed code.

The namespace contains two component classes, DirectoryEntry and DirectorySearcher, which use the Active Directory Services Interfaces (ADSI) technology.

ADSI is the set of interfaces that Microsoft provides as a flexible tool for working with a variety of network providers.

ADSI gives the administrator the ability to locate and manage resources on a network with relative ease, regardless of the size of the network.

 

 

Remarks

The classes in this namespace can be used with any of the Active Directory Domain Services service providers.

The current providers are: Internet Information Services (IIS), Lightweight Directory Access Protocol (LDAP), Novell NetWare Directory Service (NDS), and WinNT.

 

ADSI is a programmatic interface for Microsoft Active Directory Domain Services that enables your applications to interact with diverse directories on a network using a single interface.

Using ADSI, you can create applications that perform common tasks, such as backing up databases, accessing printers, and administering user accounts.

 

It is assumed that you have a general understanding of Active Directory Domain Services before using these classes.

For more information on Active Directory Domain Services, see the topics

Introduction to Active Directory Objects

https://docs.microsoft.com/en-us/windows-server/identity/ad-ds/introduction-to-active-directory-domain-services-ad-ds-virtualization-level-100

and

Active Directory Technology Backgrounder

 

, as well as the following topics in the MSDN library at http://msdn.microsoft.com/library:

Active Directory Domain Services use a tree structure.

Each node in the tree contains a set of properties.

Use this namespace to traverse, search, and modify the tree, and read and write to the properties of a node.

 

The DirectoryEntry class encapsulates a node or object in the Active Directory Domain Services hierarchy.

Use this class for binding to objects, reading properties, and updating attributes.

Together with helper classes, DirectoryEntry provides support for life-cycle management and navigation methods, including creating, deleting, renaming, moving a child node, and enumerating children.

 

Use the DirectorySearcher class to perform queries against the Active Directory Domain Services hierarchy. LDAP is the only system-supplied Active Directory Service Interfaces (ADSI) provider that supports searching.

 

A search of the Active Directory Domain Services hierarchy through DirectorySearcher returns instances of SearchResult, which are contained in an instance of the SearchResultCollection class.

 

Note: Many of the classes, methods, and properties in the System.DirectoryServices namespace use the LinkDemand code access security option.

This means that the code access security demand only occurs during just-in-time compilation and that the demand is performed only on the calling assembly and not up the entire call stack.

Because of this, callers should not pass objects that are created from this namespace at runtime to code that is not trusted.

 

using Autodesk.Revit.DB; using Autodesk.Revit.UI; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Windows.Forms.Integration; using Application = Autodesk.Revit.ApplicationServices.Application; namespace 水闸闸孔总净宽计算 { public partial class 计算原理与简图 : System.Windows.Forms.Form { ExternalCommandData dataform; string msgform; ElementSet eleform; UIApplication uiapp = null; UIDocument uidoc = null; Document doc = null; Application app = null; public 计算原理与简图(ExternalCommandData data, ref string msg, ElementSet ele) { InitializeComponent(); dataform = data; msgform = msg; eleform = ele; uiapp = data.Application; uidoc = uiapp.ActiveUIDocument; doc = uidoc.Document; } private 水闸计算 水闸计算; public 计算原理与简图(水闸计算 mainFormRef) { InitializeComponent(); this.水闸计算 = mainFormRef; // 保存引用 } PreviewControl previewControl = null; string pathname = typeof(定制按钮).Assembly.Location; string filename = ""; private void 计算原理与简图_Load(object sender, EventArgs e) { int wz = pathname.LastIndexOf(@"\"); string pathsjtxt = pathname.Substring(0, wz + 1);//pathsjtxt是数据表路径的意思 filename = pathsjtxt + "水闸计算样板.rvt"; Document newDoc = app.OpenDocumentFile(filename); View3D view3D = null; //找到当前文件的3D视图 FilteredElementCollector ViewCollector = new FilteredElementCollector(newDoc).OfClass(typeof(View3D)); foreach (View3D view in ViewCollector) { if ("{3D}".Equals(view.Name) || "三维".Equals(view.Name)) { view3D = view; break; } } previewControl = elementHost1.Child as PreviewControl; if (previewControl != null) { previewControl.Dispose(); } elementHost1.Child = new PreviewControl(newDoc, view3D.Id); previewControl = elementHost1.Child as PreviewControl; } } }运行时,Document newDoc = app.OpenDocumentFile(filename);这行代码显示为将对象设置引用到对象的实例
最新发布
07-28
CS0104“Exception”是Autodesk.AutoCAD.Runtime.Exception和System.Exception”之间的不明确的引用 CS0104“Exception”是Autodesk.AutoCAD.Runtime.Exception和System.Exception”之间的不明确的引用 CS0104“Exception”是Autodesk.AutoCAD.Runtime.Exception和System.Exception”之间的不明确的引用 CS0104“Exception”是Autodesk.AutoCAD.Runtime.Exception和System.Exception”之间的不明确的引用 CS0104“Exception是Autodesk.AutoCAD.Runtime.Exception和System.Exception”之间的不明确的引用 CS0104“Exception”是Autodesk.AutoCAD.Runtime.Exception和System.Exception”之间的不明确的引用 CS0104“Exception”是Autodesk.AutoCAD.Runtime.Exception和System.Exception”之间的不明确的引用 CS0104“Exception"是Autodesk.AutoCAD.Runtime.Exception和System.Exception”之间的不明确的引用 CS0104“Exception”是Autodesk.AutoCAD.Runtime.Exception和System.Exception”之间的不明确的引用 CS0104“Exception”是Autodesk.AutoCAD.Runtime.Exception和System.Exception”之间的不明确的引用 CS0104“Exception”是Autodesk.AutoCAD.Runtime.Exception和System.Exception”之间的不明确的引用 CS0104“Exception”是Autodesk.AutoCAD.Runtime.Exception和System.Exception"之间的不明确的引用 CS0104“Exception是Autodesk.AutoCAD.Runtime.Exception和System.Exception”之间的不明确的引用 CS0104“Exception”是Autodesk.AutoCAD.Runtime.Exception和System.Exception”之间的不明确的引用 CS0104“Exception”是"Autodesk.AutoCAD.Runtime.Exception和System.Exception”之间的不明确的引用 CS0104“Exception”是“Autodesk.AutoCAD.Runtime.Exception”和System.Exception”之间的不明确的引用
07-13
代码优化 using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; using System.Runtime.InteropServices; namespace EMCL { //public interface IScriptVM_Console //{ // bool WriteDebug(string info); // bool WriteInfo(string info); // bool WriteWarn(string info); // bool WriteError(string info); // bool WriteException(Exception e); // string ReadLine(); //}; public interface IScriptVM : IDisposable { SimpleLogger Logger { get; set; } Assembly HostAssembly { get; set; } ICollection<string> SearchPath { get; } ICollection<string> PreloadAssembly { get; } bool VM_Init(); bool VM_Exit(); bool VM_Renew(); void VM_LogException(Exception e); //void VM_SetConsole(IScriptVM_Console con); bool VM_LoadStdLib(string name); string DefaultScriptPath { get; set; } bool VM_LoadFile(string sFile); object VM_Find(string name); bool VM_List(ref Dictionary<object, object> vars); object VM_Run(string sLine); dynamic VM_Call(string name, params object[] args); //void VM_SetVar(string name, object obj); //dynamic VM_GetVar(string name); //void VM_DelVar(string name); //bool VM_HasVar(string name); //string[] VM_List(); //Dictionary<object, object> VM_ListVars(); } public class CScriptVM { static public IScriptVM CreateVM(string sLanguage) { string sClassName = "SimpleScript.ScriptVM_Impl"; string sFuncName = "CreateVM"; string sDrvPath = sLanguage; string sDrvName = sLanguage; if (!Path.IsPathRooted(sDrvPath)) { String path = AppDomain.CurrentDomain.BaseDirectory; sDrvPath = path + "SimpleScriptVM_" + sLanguage + ".dll"; } else { sDrvName = ""; } object[] ps = null;// new object[1] { sDrvName }; object res = PluginLoader.CallAssemblyFunction(sDrvPath, sClassName, sFuncName, ps); if (null == res) return null; return (IScriptVM)res; } } }
06-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值