Muhammad Babar
Muhammad Babar

Reputation: 131

How to post media on google plus through google api?

private void googleplue()
{
    Moment body = new Moment();
    ItemScope itemScope = new ItemScope();

    itemScope.Id = "replacewithuniqueforaddtarget";
    itemScope.Image = "http://www.google.com/s2/static/images/GoogleyEyes.png";
    itemScope.Type = "";
    itemScope.Description = "The description for the action";
    itemScope.Name = "An example of add activity";

    body.Object = itemScope;
    body.Type = "http://schema.org/AddAction";

    MomentsResource.InsertRequest insert =
        new MomentsResource.InsertRequest(
            plusService,
            body,
            userId,
            MomentsResource.Collection.Vault);
   // Moment wrote = insert.Fetch();
}

I tried this but not work please give me any other solution.

Upvotes: 1

Views: 653

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 117301

Moment isn't the same as posting to Google+ timeline its not possible to post to the Google+ timeline. see Issue 41: Write access to the streams

In order to post moments which isn't the same thing, you need to be able to set request_visible_actions as part of the authentication process and it doesn't appear that its possible to do with with the current version of the C# client library see

If you want to post moments and not write to a user time line then your going to have to figure out how to send the request_visible_actions as part of your authentication. if you do figure out how to do that please post the answer on my question.

Upvotes: 1

Related Questions