Post to a group I administer

Feb 5, 2014 at 12:25 AM
I figured out how to use the FB Module and up to this point all is good..

I have not figured out how to Post to a Group Page I created and administer.

Would you please guide me through this?

Thanks..
Coordinator
Feb 7, 2014 at 5:23 AM
Thanks Eric! Please let me know if this works for you.

You can manage pages by using New-FBConnection -PageId <id> (where the ID comes from Get-Page). However, I have not built infrastructure for managing groups in this fashion. No one asked for it. I just tried this and it works (assuming there is exactly one group):
$group = Get-FBGroup # if more than one, select the right one
$parameters = New-Object 'system.collections.generic.dictionary[string,object]'
$parameters["message"] = "Test message to group"
$raw = $connection.Post("$($group.id)\feed",$parameters)
$raw
Note that there were changes which limit the power of Facebook groups, I think by limiting the maximum number of people who can join. If you want better group support, please add an item under Issues and name the commands you would want to use.

Thanks,

Jon
Feb 7, 2014 at 5:37 AM
Group being an interest page such as this one id = 509845155799268

This is the page I created and manage through my account.. I want to post to it...





Dec 4, 2014 at 10:08 PM
When I use your sample script, I get an error about calling a method on a null valued expression. Do I need to define a value for $connection?
Dec 4, 2014 at 10:08 PM
When I use your sample script, I get an error about calling a method on a null valued expression. Do I need to define a value for $connection?

jonn_msft wrote:
Thanks Eric! Please let me know if this works for you.

You can manage pages by using New-FBConnection -PageId <id> (where the ID comes from Get-Page). However, I have not built infrastructure for managing groups in this fashion. No one asked for it. I just tried this and it works (assuming there is exactly one group):
$group = Get-FBGroup # if more than one, select the right one
$parameters = New-Object 'system.collections.generic.dictionary[string,object]'
$parameters["message"] = "Test message to group"
$raw = $connection.Post("$($group.id)\feed",$parameters)
$raw
Note that there were changes which limit the power of Facebook groups, I think by limiting the maximum number of people who can join. If you want better group support, please add an item under Issues and name the commands you would want to use.

Thanks,

Jon
Coordinator
Dec 4, 2014 at 10:48 PM
Yes, I should have mentioned that you need to call "$connection = New-FBConnection -PageId <id>". I retested and this still works for me. Please let me know if it works for you!
Dec 4, 2014 at 11:10 PM
Yeah, I tried that about 30 seconds after I posted the message :). One other thing, is there any way for it to generate the thumbnail images that it normally would if I posted a link or picture?
Coordinator
Dec 4, 2014 at 11:21 PM
According to https://developers.facebook.com/docs/graph-api/reference/v2.2/group/feed, you should be able to specify parameter "link" as well.
Dec 11, 2014 at 7:01 PM
So another thing came up today as I was working on my script, all of a sudden I am getting an error message that I do not have admin permissions for the group I am attempting to post to.

The only thing I can think of that has changed is that I upgraded my computer from Windows 7 to Windows 8.1, anything in particular I should check? get-fbgroup gives me this output, so it seems weird that it thinks I'm no longer an admin:
bookmark_order : 1
name           : My Test Group
administrator  : True
id             : redacted
GroupId        : redacted
Coordinator
Dec 11, 2014 at 7:48 PM
FacebookPSModule stores your Facebook access token encrypted in your user profile. I don't know exactly what happened, but my guess is that the OS upgrade changed your user profile's internal encryption key, such that the saved token can no longer be decrypted. New-FBConnection -Logoff and then New-FBConnection should solve the issue. Please let me know!