Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
IManAndQuery andQuery = new ManAndQueryClass();
annaL
Hi Everyone
Has anyone used the above to perform a search query. I thought I would look at the example in the COM Manual for the SDK and the example does not work. The statement IManAndQuery andQuery = new ManAndQueryClass();
throws a compilation error stating the ManAndQueryClass does not have any constructors.
Im probably doing something daft but given this is in the manual - I cant see whats wrong.
Can anyone help?
anna
Find more posts tagged with
Comments
guido1
try just
var andQuery = new ManAndQuery();
This is more to do with .NET's COM interop and how .NET decided to translate the IManage COM type library when you imported it as a reference to your project.
Despite what the SDK might propose as an example, in general you should never use the "*Class" variants of a COM class.
If you need to know more, Andrew Whitechapel's book on .NET development for Office has a good explanation of the reasons why the .NET COM type library importer creates these, and why you should use the interface rather than the class.
annaL
Many thanks. I ended up using IManAndQuery andQuery = new ManAndQuery();
It just foxed me why they were showing the example in this manner - I will know in future.
Thanks again for your help
a.