Forum

HELP | POWERSHELL T...
 
Notifications
Clear all

HELP | POWERSHELL TO VBA

4 Posts
2 Users
0 Reactions
99 Views
(@umajanakaraj)
Posts: 2
New Member
Topic starter
 

Hi All,

Can someone help me to convert the below script to vba

$GroupId=1234567 #my group_id
$Token = "12345678-987asdf786adsf34xxxxx" #my token
$Headers = @{ "Authorization" = "Bearer "+ $Token }
$GroupCycle = 1
DO
{
$GetMoreGroupsUri = "https://www.yammer.com/api/v1/users/in_group/$GroupId.xml?page=$GroupCycle"
write-host ("REST API CALL : $GetMoreGroupsUri")
[xml]$Xml = ((Invoke-WebRequest -Uri $GetMoreGroupsUri -Method Get -Headers $Headers).content)
$YammerGroups += $Xml.response.users.user
$GroupCycle ++
$GroupCount += $Xml.response.users.user.count
write-host ("GROUPMEMBER COUNT : $GroupCount")
}
While ($Xml.response.users.user.count -gt 0)
$YammerGroups | Where {$_} | Export-Csv "YammerCommunity$GroupId.csv" -Delimiter ","
 
 
Posted : 15/10/2020 7:54 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi,

Can you give an explanation of what it is trying to do and what you want.

It looks like it is trying to get some info about Groups on Yammer?

Phil

 
Posted : 15/10/2020 8:30 am
(@umajanakaraj)
Posts: 2
New Member
Topic starter
 

Hi,

I wanted to export yammer members to csv using this powershell script.

But wanted to share it across stakeholders. So i have created macros with vba calling the .ps1 script.

if i want to share macros I also have to share the script file.

to avoid it, if i convert ps script to vba, i can edit vba module and replace it and share only the macros to the stakeholders.

- Uma

 
Posted : 15/10/2020 9:05 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Uma,

I've never done this with VBA, or even know if it can be done.  But you could implement it with with Power Query although it isn't a trivial task.

You need to refer to the yammer doco for how to implement this 

https://developer.yammer.com/docs/oauth-2

and then write the API code in Power Query (in Excel). 

Phil

 
Posted : 26/10/2020 11:58 pm
Share: