通过.NET使谷歌加柱(C#) [英] Make Google Plus post through .NET (C#)

查看:134
本文介绍了通过.NET使谷歌加柱(C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好所有。

有没有人有这方面的例子,如何通过.NET(C#),使谷歌加后。

Does anyone has a working example how to make Google Plus post through .NET (C#).

我已经尝试过谷歌和计算器搜索,但没能找到解决办法。

I have already tried google and stackoverflow search, but did not manage to find the solution.

我顺利拿到帖子:

    public void Post(string text)
    {
        PlusService plus = new PlusService {Key = "MYVERYSECRETKEY"};

        ActivitiesResource ar = new ActivitiesResource(plus, null);

        ActivitiesResource.ListRequest list = ar.List("108055870103885325249", new ActivitiesResource.Collection());
        ActivityFeed feed = list.Fetch();

        string activityKey = "";
        foreach (var a in feed.Items)
            if (a.Url == "https://plus.google.com/108055870103885325249/posts/EtvvUgn8eKz")
            {
                activityKey = a.Id;
                break;
            }

        ActivitiesResource.GetRequest get = ar.Get(activityKey);
        Activity act = get.Fetch();
        var sb = new System.Text.StringBuilder();
        sb.AppendLine("Title: " + act.Title);
        sb.AppendLine("URL:" + act.Url);
        sb.AppendLine("Published:" + act.Published);
        sb.AppendLine("By:" + act.Actor.DisplayName);
        sb.AppendLine("Annotation:" + act.Annotation);
        sb.AppendLine("Content:" + act.Object.Content);
        sb.AppendLine("Type:" + act.Object.ObjectType);
        sb.AppendLine("# of +1s:" + act.Object.Plusoners.TotalItems);
        sb.AppendLine("# of reshares:" + act.Object.Resharers.TotalItems);
    }

但我找不到任何方法制作的帖子。

But I cannot find any method for making posts.

在此先感谢。

推荐答案

目前,在Google+的API不允许职位写入用户的活动流。您可以使用 moments.insert方法在Google+的REST API 写<一个HREF =htt​​ps://developers.google.com/+/features/app-activities相对=nofollow>应用活动以用户的配置文件,用户可以选择是否公开或分享自己的圈子。

Currently, the Google+ API does not allow writing of posts to a user's activity stream. You can use the moments.insert method in the Google+ REST API to write App Activities to the user's profile, which the user can choose whether to share publicly or to their circles.

您将与REST API的工作以类似的方式向其他的REST API在.NET中张贴到的 moments.insert 终点。

You would work with the REST API in a similar manner to other REST APIs in .NET by POSTing to the moments.insert end-point.

此功能现在可用于该请求 https://www.googleapis.com/auth/plus.login 范围和指定的时刻的类型的应用程序要在 request_visible_actions 参数无论是在 Google+登录功能按钮或直接在OAuth的查询参数。

This feature is now available to apps that request the https://www.googleapis.com/auth/plus.login scope and specify the type of moments that the app wants to write in the request_visible_actions parameter either in the Google+ Sign-In button or directly in the OAuth query parameters.

这篇关于通过.NET使谷歌加柱(C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆