How do i get the message body from an servicebus message in powershell?How to run a PowerShell scriptHow to handle command-line arguments in PowerShellHow do I pass multiple parameters into a function in PowerShell?How to pass an argument to a PowerShell script?How do you comment out code in PowerShell?How do I concatenate strings and variables in PowerShell?.Net Core Serialize an Object with IEnumerables<T> to Save as XMLAzure Functions Service Bus Trigger: getting Serialization exception when trying to bind to custom classInvoking callbacks from PowerShell functionsAzure ServiceBus Message Serialization/Deserialization

Company requiring me to let them review research from before I was hired

Considerations when providing money to one child now, and the other later?

How could an engineer advance human civilization by time traveling to the past?

Sci-fi short story: plants attracting spaceship and using them as a agents of pollination between two planets

What's the explanation for this joke about a three-legged dog that walks into a bar?

Are gangsters hired to attack people at a train station classified as a terrorist attack?

What's the 1 inch size square knob sticking out of wall?

Why do people say "I am broke" instead of "I am broken"?

When were "acrobatics" introduced at weddings?

Are glider winch launches rarer in the USA than in the rest of the world? Why?

How to repair basic cable/wire issue for household appliances

How can I make sure my players' decisions have consequences?

Is the apartment I want to rent a scam?

Extrapolation v. Interpolation

Why did computer video outputs go from digital to analog, then back to digital?

Historicity doubted by Romans

Short story where a flexible reality hardens to an unchanging one

Using paddles to support a bug net

Where is this photo of a group of hikers taken? Is it really in the Ural?

Is it possible to eat quietly in Minecraft?

Impact of throwing away fruit waste on a peak > 3200 m above a glacier

What is an Eternal Word™?

ExactlyOne extension method

Why did NASA use Imperial units?



How do i get the message body from an servicebus message in powershell?


How to run a PowerShell scriptHow to handle command-line arguments in PowerShellHow do I pass multiple parameters into a function in PowerShell?How to pass an argument to a PowerShell script?How do you comment out code in PowerShell?How do I concatenate strings and variables in PowerShell?.Net Core Serialize an Object with IEnumerables<T> to Save as XMLAzure Functions Service Bus Trigger: getting Serialization exception when trying to bind to custom classInvoking callbacks from PowerShell functionsAzure ServiceBus Message Serialization/Deserialization






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm trying to learn about some PowerShell and dotnet so I'm using some code I found.



I'm trying to grab some messages off my service bus using PowerShell and I'm able to send to the queue, but I'm a bit lost on receiving them.



I'm able to get the ID of the message but I'm having trouble getting the body.



The code I attached with the post is giving me the following exception.




"calling "Invoke" with "2" argument(s): "Expecting element 'string'
from namespace'http://schemas.microsoft.com/2003/10/Serialization/'..
Encountered 'Element' with name 'FileInfo', namespace
'http://schemas.datacontract.org/2004 /07/System.IO'. "




Is this the correct way to go about doing this if it has to be PowerShell?



I've looked into the Microsoft documentation for the datacontractserializer (which i think is the way go?), but I'm unsure on the formatting in converting it from dotnet to PowerShell



$BindingFlags= [Reflection.BindingFlags] "Public,Instance"
$generic_method = $message.GetType().GetMethod("GetBody",$BindingFlags,$null, @(),$null).MakeGenericMethod([String]).Invoke($message,$null)









share|improve this question






























    0















    I'm trying to learn about some PowerShell and dotnet so I'm using some code I found.



    I'm trying to grab some messages off my service bus using PowerShell and I'm able to send to the queue, but I'm a bit lost on receiving them.



    I'm able to get the ID of the message but I'm having trouble getting the body.



    The code I attached with the post is giving me the following exception.




    "calling "Invoke" with "2" argument(s): "Expecting element 'string'
    from namespace'http://schemas.microsoft.com/2003/10/Serialization/'..
    Encountered 'Element' with name 'FileInfo', namespace
    'http://schemas.datacontract.org/2004 /07/System.IO'. "




    Is this the correct way to go about doing this if it has to be PowerShell?



    I've looked into the Microsoft documentation for the datacontractserializer (which i think is the way go?), but I'm unsure on the formatting in converting it from dotnet to PowerShell



    $BindingFlags= [Reflection.BindingFlags] "Public,Instance"
    $generic_method = $message.GetType().GetMethod("GetBody",$BindingFlags,$null, @(),$null).MakeGenericMethod([String]).Invoke($message,$null)









    share|improve this question


























      0












      0








      0








      I'm trying to learn about some PowerShell and dotnet so I'm using some code I found.



      I'm trying to grab some messages off my service bus using PowerShell and I'm able to send to the queue, but I'm a bit lost on receiving them.



      I'm able to get the ID of the message but I'm having trouble getting the body.



      The code I attached with the post is giving me the following exception.




      "calling "Invoke" with "2" argument(s): "Expecting element 'string'
      from namespace'http://schemas.microsoft.com/2003/10/Serialization/'..
      Encountered 'Element' with name 'FileInfo', namespace
      'http://schemas.datacontract.org/2004 /07/System.IO'. "




      Is this the correct way to go about doing this if it has to be PowerShell?



      I've looked into the Microsoft documentation for the datacontractserializer (which i think is the way go?), but I'm unsure on the formatting in converting it from dotnet to PowerShell



      $BindingFlags= [Reflection.BindingFlags] "Public,Instance"
      $generic_method = $message.GetType().GetMethod("GetBody",$BindingFlags,$null, @(),$null).MakeGenericMethod([String]).Invoke($message,$null)









      share|improve this question
















      I'm trying to learn about some PowerShell and dotnet so I'm using some code I found.



      I'm trying to grab some messages off my service bus using PowerShell and I'm able to send to the queue, but I'm a bit lost on receiving them.



      I'm able to get the ID of the message but I'm having trouble getting the body.



      The code I attached with the post is giving me the following exception.




      "calling "Invoke" with "2" argument(s): "Expecting element 'string'
      from namespace'http://schemas.microsoft.com/2003/10/Serialization/'..
      Encountered 'Element' with name 'FileInfo', namespace
      'http://schemas.datacontract.org/2004 /07/System.IO'. "




      Is this the correct way to go about doing this if it has to be PowerShell?



      I've looked into the Microsoft documentation for the datacontractserializer (which i think is the way go?), but I'm unsure on the formatting in converting it from dotnet to PowerShell



      $BindingFlags= [Reflection.BindingFlags] "Public,Instance"
      $generic_method = $message.GetType().GetMethod("GetBody",$BindingFlags,$null, @(),$null).MakeGenericMethod([String]).Invoke($message,$null)






      azure powershell .net-core azureservicebus






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 26 at 21:07









      AdminOfThings

      5,6952 gold badges2 silver badges14 bronze badges




      5,6952 gold badges2 silver badges14 bronze badges










      asked Mar 26 at 15:16









      Mathias WrobelMathias Wrobel

      134 bronze badges




      134 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Download and try this example to learn from …



          biz.dfch.PS.Azure.ServiceBus.Client 1.0.2.20160609



          function Get-MessageBody 
          <#
          .SYNOPSIS
          Get the message body from a Service Bus Message.

          .DESCRIPTION
          Get the message body from a Service Bus Message.

          .OUTPUTS
          This Cmdlet returns the Body as [String] from the MessageFactory Message object. On failure it returns $null.

          .INPUTS
          See PARAMETER section for a description of input parameters.

          .EXAMPLE
          Get the message body from a Service Bus Message.

          PS > Get-Message # function

          if($MyInvocation.ScriptName) Export-ModuleMember -Function Get-MessageBody;





          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55360606%2fhow-do-i-get-the-message-body-from-an-servicebus-message-in-powershell%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Download and try this example to learn from …



            biz.dfch.PS.Azure.ServiceBus.Client 1.0.2.20160609



            function Get-MessageBody 
            <#
            .SYNOPSIS
            Get the message body from a Service Bus Message.

            .DESCRIPTION
            Get the message body from a Service Bus Message.

            .OUTPUTS
            This Cmdlet returns the Body as [String] from the MessageFactory Message object. On failure it returns $null.

            .INPUTS
            See PARAMETER section for a description of input parameters.

            .EXAMPLE
            Get the message body from a Service Bus Message.

            PS > Get-Message # function

            if($MyInvocation.ScriptName) Export-ModuleMember -Function Get-MessageBody;





            share|improve this answer



























              0














              Download and try this example to learn from …



              biz.dfch.PS.Azure.ServiceBus.Client 1.0.2.20160609



              function Get-MessageBody 
              <#
              .SYNOPSIS
              Get the message body from a Service Bus Message.

              .DESCRIPTION
              Get the message body from a Service Bus Message.

              .OUTPUTS
              This Cmdlet returns the Body as [String] from the MessageFactory Message object. On failure it returns $null.

              .INPUTS
              See PARAMETER section for a description of input parameters.

              .EXAMPLE
              Get the message body from a Service Bus Message.

              PS > Get-Message # function

              if($MyInvocation.ScriptName) Export-ModuleMember -Function Get-MessageBody;





              share|improve this answer

























                0












                0








                0







                Download and try this example to learn from …



                biz.dfch.PS.Azure.ServiceBus.Client 1.0.2.20160609



                function Get-MessageBody 
                <#
                .SYNOPSIS
                Get the message body from a Service Bus Message.

                .DESCRIPTION
                Get the message body from a Service Bus Message.

                .OUTPUTS
                This Cmdlet returns the Body as [String] from the MessageFactory Message object. On failure it returns $null.

                .INPUTS
                See PARAMETER section for a description of input parameters.

                .EXAMPLE
                Get the message body from a Service Bus Message.

                PS > Get-Message # function

                if($MyInvocation.ScriptName) Export-ModuleMember -Function Get-MessageBody;





                share|improve this answer













                Download and try this example to learn from …



                biz.dfch.PS.Azure.ServiceBus.Client 1.0.2.20160609



                function Get-MessageBody 
                <#
                .SYNOPSIS
                Get the message body from a Service Bus Message.

                .DESCRIPTION
                Get the message body from a Service Bus Message.

                .OUTPUTS
                This Cmdlet returns the Body as [String] from the MessageFactory Message object. On failure it returns $null.

                .INPUTS
                See PARAMETER section for a description of input parameters.

                .EXAMPLE
                Get the message body from a Service Bus Message.

                PS > Get-Message # function

                if($MyInvocation.ScriptName) Export-ModuleMember -Function Get-MessageBody;






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 27 at 0:45









                postanotepostanote

                4,9982 gold badges4 silver badges11 bronze badges




                4,9982 gold badges4 silver badges11 bronze badges


















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55360606%2fhow-do-i-get-the-message-body-from-an-servicebus-message-in-powershell%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript