Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / December 2004

Tip: Looking for answers? Try searching our database.

Unwrapping objects

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mattia Saccotelli - 03 Dec 2004 16:54 GMT
How to unwrap SemiTrust's objects?
An MSDN's tutorial did the following:

private Microsoft.Office.Core.CommandBars UnwrapCommandbarsObject(
    Microsoft.Office.Interop.InfoPath.SemiTrust.ObjectWrapper
commandBarsWrapper ) {
    Type t = commandBarsWrapper.GetType().BaseType;

    Microsoft.Office.Core.CommandBars objCommandBars =
        (Microsoft.Office.Core.CommandBars)t.InvokeMember( "InnerObject",
        BindingFlags.Public | BindingFlags.NonPublic |
        BindingFlags.Instance | BindingFlags.GetProperty,
        null, commandBarsWrapper, null);

    return objCommandBars;
}

to access the CommandBar. I need to access the thisXDocument.DataObjects
to modify query parameters as in JavaScript. In JS it would be:

strSqlCommand =
XDocument.DataObjects.Item("SalesSummary").QueryAdapter.Command;

strSqlCommand = strSqlCommand.replace(/@Ending_Date='[^']+'/,
"@Ending_Date='" + SqlDateTime(dtEnd) + "'");

How to access the Command property?? It's not there in the C# object!
Ms experts????

thanks!
Matthew Blain \(Serriform\) - 05 Dec 2004 01:01 GMT
Make sure you have the right type of object. E.g. ADOAdapter, not just
QueryAdapter. Cast as needed.

--Matthew Blain
http://tips.serriform.com/
http://www.developingsolutionswithinfopath.com/

> How to unwrap SemiTrust's objects?
> An MSDN's tutorial did the following:
[quoted text clipped - 26 lines]
>
> thanks!
Mattia Saccotelli - 06 Dec 2004 08:13 GMT
How could I know to which type perform the cast?

Matthew Blain (Serriform) wrote:
> Make sure you have the right type of object. E.g. ADOAdapter, not just
> QueryAdapter. Cast as needed.
[quoted text clipped - 33 lines]
>>
>>thanks!
Matthew Blain \(Serriform\) - 07 Dec 2004 01:04 GMT
One way is to use the InfoPath help integrated into Visual Studio. Go to
Help, Search, filter on Microsoft Office InfoPath2003, and search for
Command.

This is also covered in Chapter 6 of the book below.

--Matthew Blain
http://tips.serriform.com/
http://www.developingsolutionswithinfopath.com/

> How could I know to which type perform the cast?
>
[quoted text clipped - 36 lines]
> >>
> >>thanks!
Mattia Saccotelli - 07 Dec 2004 09:35 GMT
Thanks Matthew, I found the help very useful.
Btw I'm working with a web service so I used:

WebServiceAdapter2 wsA =
(WebServiceAdapter2)thisXDocument.DataAdapters["ElencoSchede"];

What I have to do is change a parameter of the WebMethod, to refresh the
query. I didn't find any property/method to do so.

I did it using a DOMDocument50Class object, I copied into it the

thisXDocument.DataObjects["ElencoSchede"].DOM

to replace the query value: I wasn't able to selectSingleNode directly
on the original DOM because of namespace's issues, actually I had to set
the needed namespace on the new object.

It's quite a long way to perform a simple task, I wonder if I'm missing
something about the WebServiceAdapter2 capabilities.

thanks

Matthew Blain (Serriform) wrote:
> One way is to use the InfoPath help integrated into Visual Studio. Go to
> Help, Search, filter on Microsoft Office InfoPath2003, and search for
[quoted text clipped - 51 lines]
>>>>
>>>>thanks!
Matthew Blain \(Serriform\) - 10 Dec 2004 21:45 GMT
The adapter doesn't do anything special with the DOM (you can also call
GetDOM("elencoschede")). You will always have to deal with namespace issues
when using xpath. Typically I set namespace prefixes early in the process
(e.g. in the onload event, or immediately after calling Query).

You can also use rules or default values to set parameters in the web
service.

--Matthew

> Thanks Matthew, I found the help very useful.
> Btw I'm working with a web service so I used:
[quoted text clipped - 74 lines]
> >>>>
> >>>>thanks!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.