.net

Error HRESULT E_FAIL when creating Exchange mailbox (CDOEXM.IMailboxStore.CreateMailbox)

I am trying to automate the process of creating an Exchange Mailbox for AD users and am running into an issue. When calling the CreateMailbox method I am receiving the error "Error HRESULT E_FAIL has been returned from a call to a COM component". I have installed and referenced the Exchange Management Tools and am using impersonation f...

How to Eager Load entire SQL table in LINQ?

Writing my first Linq application, and I'm trying to find the best way to do the following: I want to load the entire employees table at once to populate the cache (used for form autocomplete). I can do - var query = from employee in db.Employees select employee; foreach (Employee e in query) { ... } But since this is deferred...

Generating a lot of static html

I have a process that will need to generate a lot of static html from a set of data. The html is relatively complex and I want the maintenance to be fairly simple so I don't want to embed much if any html in program code. At my company the blessed tool set is .net or php. My initial thought was to embed the asp.net compiler into the ...

How to send input to the console as if the user is typing?

This is my problem. I have a program that has to run in a TTY, cygwin provides this TTY. When I redirect stdIn the program fails because it does not have a TTY. I cannot modify this program, and need some way of automating it. How can I grab the cmd.exe window and send it data and make it think the user is typing it? I'm using C#, I ...

Why does my VB.NET class library show "My" and "My.Resources" namespaces in Reflector?

I have no intention of using "My" for anything in any of my projects. I haven't done anything with it (that I know of). But every one of class libraries shows a "My" namespace in Reflector and NDepend. This adds a lot of unnecessary clutter. 1) Why does it show up? 2) How can I remove it? ...

Why is "Microsoft.VisualBasic.Compatibility.dll" missing from the .NET Framework v1.1.4322 folder?

I've started to use a Vista machine for development. In case it is significant: I'm using MSBee so that I can code in the Visual Studio 2005 IDE while still building against the 1.1 framework. On the Vista machine, when I tried to build a particular vb project, I got this error: error BC30464: Namespace or type 'Compatibility' in...

Continuous Integration Fix for NAnt 0.86 Beta 1 with .NET 3.5

Hi All, I have been trying to use the latest NAnt (0.86 Beta 1) for a few weeks now in several .NET 3.0/3.5 projects as using multiple .sln solution files to build the platform code on my build server but alws ran to error and having this problem : BUILD FAILED Solution format of file 'C:***\Platform.sln' is not supported. ...

Parsing command output in .NET

I want to connect up to a database server in my .NET app and execute a database command that produces a series of database statistics. The problem is that it doesn't return the stats in a structured format, it returns it in plain text (like a df -k command in UNIX) I can capture the output and parse it, but I was wondering if there's a...

SaveFileDialog blocking removeable drive

I'm using a SaveFileDialog to let a user pick a directory and filename on a removeable drive. Afterwards I create that file, write to it, and close it again. By then the file itself is not locked (editable, deleteable), but I can't eject the drive because windows claims it is still in use. I have to exit the application before an eject ...

Expose a specific .net object as JSON

I'm currently enabling JSON calls to my web services using the ScriptService attribute. The problem is that one of my classes references a second class and .Net is not picking up and writing out the JavaScript for the second class. As a workaround I can write a dummy method that just returns the second class. Then .Net writes the JS...

How to get a Static property with Reflection

So this seems pretty basic but I can't get it to work. I have an Object, and I am using reflection to get to it's public properties. One of these properties is static and I'm having no luck getting to it. Public Function GetProp(ByRef obj As Object, ByVal propName as String) as PropertyInfo Return obj.GetType.GetProperty(propName)...

DataTable to JSON

I recently needed to serialize a datatable to JSON. Where I'm at we're still on .Net 2.0, so I can't use the JSON serializer in .Net 3.5. I figured this must have been done before, so I went looking online and found a number of different options. Some of them depend on an additional library, which I would have a hard time pushing thro...

How can i determine which of my product's .net assemblies are registered, when i have several on my pc?

I have the code for various versions of a software product I work on on my machine. The product includes one or more assemblies that are registered for com interop. How can I determine which one is currently registered? ...

How to open a file inside a Test Project code folder? (Visual Studio 2008 and .NET C#)

When I run a Test Project on Visual Studio I use the code below to access a file inside the test project code folder var Location = System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName ); var FileLocation = Path.Combine( Location ,@"..\..\..\TestProject1\App_Data\da...

Designing a generic interface, require the type parameter on the type or method?

I have a very thin interface that's going to define one method. Should I require the type parameter on the class definition? public interface ISomethingFun<T> { void Do(T item); } or method definition? public interface ISomethingFun { void Do<T>(T item); } What rationale? Is one easier to implement, inherit, or generate dyn...

How do I know what encoding scheme to use when converting a string to a byte array?

From my database I am getting a very long string which is basically xml. I need to change it to a byte array. I can't get my head around the potential encoding issues. What do I need to be careful of when doing this conversion? public static byte[] StringToByteArray1(string str) { return Encoding.ASCII.GetBytes(str); ...

Best way to parse string of email addresses

So i am working with some email header data, and for the to:, from:, cc:, and bcc: fields the email address(es) can be expressed in a number of different ways: First Last <[email protected]> Last, First <[email protected]> [email protected] And these variations can appear in the same message, in any order, all in one comma separated string:...

Good logging library for managed/unmanaged application ?

What logging library or approach would you recommend for this case: We want to be able to log both from managed and unmanaged code For the unmanaged code, the implementation should not cross back into managed code, because this could cause our unmanaged threads to get 'caught' during a garbage collection. Performance is a concern NLo...

Multi Database Support

When creating an app with Multi-database support,what are the advantages and disadvantages of using Enterprise Library vs using a generic object of type OleDb? ...

In Vista in Administrative Tools the Microsoft .NET Framework Configuration shortcut is gone, how do I view the GAC?

I'm trying to view the items in the GAC on Vista and I've got all the .NET stuff installed, 1.0, 2.0, 3.5 and 3.5 SP1 but I don't see shortcut from Administrative Tools. Does anyone know another way to view and edit the items in the GAC? ...