cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Justin-GOV
Frequent Visitor

How do you use the Office365.Groups.HttpRequest(URI, Method, file)

I would like to query Graph from PowerApps by providing a Group DisplayName or mailNickName.

 

Currently this works in Graph Explorer - https://graph.microsoft.com/v1.0/groups?$filter=mailNickname eq '<nickname>' but I can't find any documentation to use the Office365.Groups.HttpRequest("https://graph.microsoft.com/v1.0/groups?$filter=mailNickname eq '<nickname>'", "GET", file) to make it work.

 

What am I supposed to use for 'file'?

 

Where do I find information about how to structure the formula in PowerApps? I am trying to use instructions from this docs.microsoft.com page: Office 365 Groups - Connectors | Microsoft Docs

31 REPLIES 31
johnxt
Helper II
Helper II

I've been fighting this for nearly 2 solid days, many thanks to dotter for putting me on the right track. So here's how I did it, forget the image box you don't need that. Just generate yourself the proper string and put it into a variable, then send that to the httprequest. The reason why dotter's example code didnt work for you as typed is because of a slight error it should be "data:" not "data&colon;" (some kind of html decoding issue somewhere along the line I guess)

 

For testing, I made 2 buttons to quickly generate the required string then post it into a list on our sharepoint site. Button1.OnSelect:

Set(myJSONString, 
    "{""fields"":{""Title"":""John Smith""}}"
);
Set(myBinaryString,With({
    InputText:myJSONString,
    AsciiTable:AddColumns(Sequence(2^8,1),"char",Char(Value)),
    B64ToBin:
    Table(
        {b64:"A",bin:"000000"},
        {b64:"B",bin:"000001"},
        {b64:"C",bin:"000010"},
        {b64:"D",bin:"000011"},
        {b64:"E",bin:"000100"},
        {b64:"F",bin:"000101"},
        {b64:"G",bin:"000110"},
        {b64:"H",bin:"000111"},
        {b64:"I",bin:"001000"},
        {b64:"J",bin:"001001"},
        {b64:"K",bin:"001010"},
        {b64:"L",bin:"001011"},
        {b64:"M",bin:"001100"},
        {b64:"N",bin:"001101"},
        {b64:"O",bin:"001110"},
        {b64:"P",bin:"001111"},
        {b64:"Q",bin:"010000"},
        {b64:"R",bin:"010001"},
        {b64:"S",bin:"010010"},
        {b64:"T",bin:"010011"},
        {b64:"U",bin:"010100"},
        {b64:"V",bin:"010101"},
        {b64:"W",bin:"010110"},
        {b64:"X",bin:"010111"},
        {b64:"Y",bin:"011000"},
        {b64:"Z",bin:"011001"},
        {b64:"a",bin:"011010"},
        {b64:"b",bin:"011011"},
        {b64:"c",bin:"011100"},
        {b64:"d",bin:"011101"},
        {b64:"e",bin:"011110"},
        {b64:"f",bin:"011111"},
        {b64:"g",bin:"100000"},
        {b64:"h",bin:"100001"},
        {b64:"i",bin:"100010"},
        {b64:"j",bin:"100011"},
        {b64:"k",bin:"100100"},
        {b64:"l",bin:"100101"},
        {b64:"m",bin:"100110"},
        {b64:"n",bin:"100111"},
        {b64:"o",bin:"101000"},
        {b64:"p",bin:"101001"},
        {b64:"q",bin:"101010"},
        {b64:"r",bin:"101011"},
        {b64:"s",bin:"101100"},
        {b64:"t",bin:"101101"},
        {b64:"u",bin:"101110"},
        {b64:"v",bin:"101111"},
        {b64:"w",bin:"110000"},
        {b64:"x",bin:"110001"},
        {b64:"y",bin:"110010"},
        {b64:"z",bin:"110011"},
        {b64:"0",bin:"110100"},
        {b64:"1",bin:"110101"},
        {b64:"2",bin:"110110"},
        {b64:"3",bin:"110111"},
        {b64:"4",bin:"111000"},
        {b64:"5",bin:"111001"},
        {b64:"6",bin:"111010"},
        {b64:"7",bin:"111011"},
        {b64:"8",bin:"111100"},
        {b64:"9",bin:"111101"},
        {b64:"+",bin:"111110"},
        {b64:"/",bin:"111111"}
    )},
    With({
    BinRep:
    Concat(
        AddColumns(ForAll(Split(InputText,""), {Result: ThisRecord.Value}),"dec",LookUp(AsciiTable,char=Result).Value),//Convert text to Ascii character code (decimal)
        Concat(Sequence(8,8,-1),Text(If(And(Mod(dec,Power(2,Value))>=Power(2,Value-1),Mod(dec,Power(2,Value))<Power(2,Value)),1,0)))&"","")//Convert decimal to binary
    },
        With({b64string:Concat(
            Sequence(
                RoundUp(Len(BinRep)/6,0),0),
                LookUp(
                    B64ToBin,
                    bin=Mid(BinRep&Left("000000",6-Mod(Len(BinRep),6)),6*Value+1,6) //Left("000000"....) is padding right with zero
                ).b64&"", 
                ""
            )},
            b64string&Left("====",Mod(4-Mod(Len(b64string),4),4))//Convert binary to base64
        )
    )
));

Set(myGeneratedBlob,"data&colon;application/json;base64," & myBinaryString)

Button2.OnSelect:

Office365Groups.HttpRequest("https://graph.microsoft.com/v1.0/sites/<sharepoint site id>/lists/<sharepoint list id>/items","POST",myGeneratedBlob)

 

johnxt
Helper II
Helper II

Ha. Just look at that. Its also messed up my button1 code the same way it did with dotters, and inside a code block no less. what a great job Microsoft!

So the last line should be this, but without spaces:

 

Set(myGeneratedBlob,"data : application/json;base64," & myBinaryString)

 

 

MRBCODC
Helper II
Helper II

I am struggling with this I am using this to get the data i want 

Set(UserAzureAD,
Office365Groups.HttpRequest(
"

https://graph.microsoft.com/v1.0/users?$filter=userPrincipalName eq 'companyemail@company.com'&$select=id,displayName,userPrincipalName,onPremisesSamAccountName,jobTitle,officeLocation

",
"GET",
""
));

 

I can not use any of the data that comes back as it is an untypedobject

I can not see how to get in to a collection or table so i can use the data I mainly need the onpremsisisamaccountname as this seems to be the only way to get it.

johnxt
Helper II
Helper II

Hello there, I'm by no means an expert at this stuff as until yesterday I hadn't even touched graph before lol

But I did find this page on my travels trying to understand the httprequest POST function, hopefully it can be of some help:
Untyped object data type - Power Platform | Microsoft Learn

Also this one:
powerapps-docs/powerapps-docs/maker/canvas-apps/untyped-and-dynamic-objects.md at main · MicrosoftDo...

 

Good luck!

MRBCODC
Helper II
Helper II

Hi @johnxt 

 

thank you fir the response, yes i have seen this page and tried to use the part about arrays but it keeps giving me an error it expect array or table but actual is object

 

Thanks

 

When trying to convert to a table using

ForAll( Table(UserAzureAD), { FirstField: Value(ThisRecord.Value.id), SecondField: Text(ThisRecord.Value.displayName) } )

 

i get below error

MRBCODC_0-1695903347581.png

 

johnxt
Helper II
Helper II

Ok, so I've been hammering away at it. And the solution is so simple, and yet such a pain 😄

Text(First(UserAzureAD.value).onPremisesSamAccountName)
johnxt
Helper II
Helper II

so what it is, if you were running a query which returns a single result e.g:

Set(varResponse, Office365Groups.HttpRequest("https://graph.microsoft.com/v1.0/me","GET",""));

You could just use Text(varResponse.displayName) and be happy.

 

As you're running a query it returns an array of results (called 'value'), which you need to handle. Since in this case you're only returning 1 result you can just use First() to get it, if you wanted to return more you would handle it in your App the usual way ForAll() or whatever

I just come to the same conclusion like you say so simple but a huge annoyance!

 

my next issue is I am trying to send a variable in the api url but it is not changing the text in the request url it is only sending the name of the variable

Yes this was driving me insane as it was working with ME endpoint but the user wasn't working 
ForAll was not working for me either as I was going to run a generic query on for all users and store in a collection and do lookup to get the data i wanted but it don't seem like that is possible

Helpful resources

Announcements

Take a short Community User Survey | Help us make your experience better!

To ensure that we are providing the best possible experience for Community members, we want to hear from you!    We value your feedback! As part of our commitment to enhancing your experience, we invite you to participate in a brief 15-question survey. Your insights will help us improve our services and better serve the community.   👉 Community User Survey    Thank you for being an essential part of our community!    Power Platform Engagement Team  

Tuesday Tip | How to Get Community Support

It's time for another Tuesday Tip, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.       This Week: All About Community Support Whether you're a seasoned community veteran or just getting started, you may need a bit of help from time to time! If you need to share feedback with the Community Engagement team about the community or are looking for ways we can assist you with user groups, events, or something else, Community Support is the place to start.   Community Support is part of every one of our communities, accessible to all our community members.   Within each community's Community Support page, you'll find three distinct areas, each with a different focus to help you when you need support from us most. Power Apps: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pa_community_support Power Automate: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpa_community_support Power Pages: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpp_community_support Copilot Studio: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pva_community-support   Community Support Form If you need more assistance, you can reach out to the Community Team via the Community support form. Choose the type of support you require and fill in the form accordingly. We will respond to you promptly.    Thank you for being an active part of our community. Your contributions make a difference!   Best Regards, The Community Management Team

Community Roundup: A Look Back at Our Last 10 Tuesday Tips

As we continue to grow and learn together, it's important to reflect on the valuable insights we've shared. For today's #TuesdayTip, we're excited to take a moment to look back at the last 10 tips we've shared in case you missed any or want to revisit them. Thanks for your incredible support for this series--we're so glad it was able to help so many of you navigate your community experience!   Getting Started in the Community An overview of everything you need to know about navigating the community on one page!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Ranks and YOU Have you ever wondered how your fellow community members ascend the ranks within our community? We explain everything about ranks and how to achieve points so you can climb up in the rankings! Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Powering Up Your Community Profile Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile. Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Blogs--A Great Place to Start There's so much you'll discover in the Community Blogs, and we hope you'll check them out today!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Unlocking Community Achievements and Earning Badges Across the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. Check out some details on Community badges--and find out more in the detailed link at the end of the article! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Blogging in the Community Interested in blogging? Everything you need to know on writing blogs in our four communities! Get started blogging across the Power Platform communities today! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Subscriptions & Notifications We don't want you to miss a thing in the community! Read all about how to subscribe to sections of our forums and how to setup your notifications! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Getting Started with Private Messages & Macros Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Community User Groups Learn everything about being part of, starting, or leading a User Group in the Power Platform Community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Update Your Community Profile Today! Keep your community profile up to date which is essential for staying connected and engaged with the community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Thank you for being an integral part of our journey.   Here's to many more Tuesday Tips as we pave the way for a brighter, more connected future! As always, watch the News & Announcements for the next set of tips, coming soon!

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!

April 2024 Community Newsletter

We're pleased to share the April Community Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members.   If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across Microsoft Power Platform and beyond.    COMMUNITY HIGHLIGHTS   Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, follow these awesome community members to see what they do!   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzDeenujialexander2523ragavanrajanLaurensMManishSolankiMattJimisonLucas001AmikcapuanodanilostephenrobertOliverRodriguestimlAndrewJManikandanSFubarmmbr1606VishnuReddy1997theMacResolutionsVishalJhaveriVictorIvanidzejsrandhawahagrua33ikExpiscornovusFGuerrero1PowerAddictgulshankhuranaANBExpiscornovusprathyooSpongYeNived_Nambiardeeksha15795apangelesGochixgrantjenkinsvasu24Mfon   LATEST NEWS Business Applications Launch Event - On Demand In case you missed the Business Applications Launch Event, you can now catch up on all the announcements and watch the entire event on-demand inside Charles Lamanna's latest cloud blog.   This is your one stop shop for all the latest Copilot features across Power Platform and #Dynamics365, including first-hand looks at how companies such as Lenovo, Sonepar, Ford Motor Company, Omnicom and more are using these new capabilities in transformative ways. Click the image below to watch today!     Power Platform Community Conference 2024 is here! It's time to look forward to the next installment of the Power Platform Community Conference, which takes place this year on 18-20th September 2024 at the MGM Grand in Las Vegas!   Come and be inspired by Microsoft senior thought leaders and the engineers behind the #PowerPlatform, with Charles Lamanna, Sangya Singh, Ryan Cunningham, Kim Manis, Nirav Shah, Omar Aftab and Leon Welicki already confirmed to speak. You'll also be able to learn from industry experts and Microsoft MVPs who are dedicated to bridging the gap between humanity and technology. These include the likes of Lisa Crosbie, Victor Dantas, Kristine Kolodziejski, David Yack, Daniel Christian, Miguel Félix, and Mats Necker, with many more to be announced over the coming weeks.   Click here to watch our brand-new sizzle reel for #PPCC24 or click the image below to find out more about registration. See you in Vegas!     Power Up Program Announces New Video-Based Learning Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram. These include a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the image below to find out more!     UPCOMING EVENTS Microsoft Build - Seattle and Online - 21-23rd May 2024 Taking place on 21-23rd May 2024 both online and in Seattle, this is the perfect event to learn more about low code development, creating copilots, cloud platforms, and so much more to help you unleash the power of AI.   There's a serious wealth of talent speaking across the three days, including the likes of Satya Nadella, Amanda K. Silver, Scott Guthrie, Sarah Bird, Charles Lamanna, Miti J., Kevin Scott, Asha Sharma, Rajesh Jha, Arun Ulag, Clay Wesener, and many more.   And don't worry if you can't make it to Seattle, the event will be online and totally free to join. Click the image below to register for #MSBuild today!     European Collab Summit - Germany - 14-16th May 2024 The clock is counting down to the amazing European Collaboration Summit, which takes place in Germany May 14-16, 2024. #CollabSummit2024 is designed to provide cutting-edge insights and best practices into Power Platform, Microsoft 365, Teams, Viva, and so much more. There's a whole host of experts speakers across the three-day event, including the likes of Vesa Juvonen, Laurie Pottmeyer, Dan Holme, Mark Kashman, Dona Sarkar, Gavin Barron, Emily Mancini, Martina Grom, Ahmad Najjar, Liz Sundet, Nikki Chapple, Sara Fennah, Seb Matthews, Tobias Martin, Zoe Wilson, Fabian Williams, and many more.   Click the image below to find out more about #ECS2024 and register today!   Microsoft 365 & Power Platform Conference - Seattle - 3-7th June If you're looking to turbo boost your Power Platform skills this year, why not take a look at everything TechCon365 has to offer at the Seattle Convention Center on June 3-7, 2024.   This amazing 3-day conference (with 2 optional days of workshops) offers over 130 sessions across multiple tracks, alongside 25 workshops presented by Power Platform, Microsoft 365, Microsoft Teams, Viva, Azure, Copilot and AI experts. There's a great array of speakers, including the likes of Nirav Shah, Naomi Moneypenny, Jason Himmelstein, Heather Cook, Karuana Gatimu, Mark Kashman, Michelle Gilbert, Taiki Y., Kristi K., Nate Chamberlain, Julie Koesmarno, Daniel Glenn, Sarah Haase, Marc Windle, Amit Vasu, Joanne C Klein, Agnes Molnar, and many more.   Click the image below for more #Techcon365 intel and register today!   For more events, click the image below to visit the Microsoft Community Days website.    

Tuesday Tip | Update Your Community Profile Today!

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   We're excited to announce that updating your community profile has never been easier! Keeping your profile up to date is essential for staying connected and engaged with the community.   Check out the following Support Articles with these topics: Accessing Your Community ProfileRetrieving Your Profile URLUpdating Your Community Profile Time ZoneChanging Your Community Profile Picture (Avatar)Setting Your Date Display Preferences Click on your community link for more information: Power Apps, Power Automate, Power Pages, Copilot Studio   Thank you for being an active part of our community. Your contributions make a difference! Best Regards, The Community Management Team

Top Solution Authors
Top Kudoed Authors
Users online (6,267)