コード例 #1
0
        static bool FacebookPost(Message message)
        {
            var targetFacebookId = "";
            var name             = "";
            var link             = "";
            var caption          = "";
            var picture          = "";
            var fbMessage        = "";
            var accesstoken      = "";
            var rootLink         = "";
            var actionName       = "";

            foreach (var field in message.Field)
            {
                if (field.key == "targetFacebookId")
                {
                    targetFacebookId = field.value;
                }
                if (field.key == "userNameCaption")
                {
                    name = field.value;
                }
                if (field.key == "link")
                {
                    link = field.value;
                }
                if (field.key == "caption")
                {
                    caption = field.value;
                }
                if (field.key == "picture")
                {
                    picture = field.value;
                }
                if (field.key == "fbMessage")
                {
                    fbMessage = field.value;
                }
                if (field.key == "accesstoken")
                {
                    accesstoken = field.value;
                }
                if (field.key == "actionName")
                {
                    actionName = field.value;
                }
                if (field.key == "rootLink")
                {
                    rootLink = field.value;
                }
            }
            var fb = new FacebookService(accesstoken);

            log.Info("posting to facebook target:" + targetFacebookId);

            var res = fb.StreamPublish(name, link, targetFacebookId, caption, picture, fbMessage, rootLink, actionName, rootLink);


            return(res);
        }
コード例 #2
0
        static bool FacebookPost(Message message)
        {
            var targetFacebookId = "";
            var name = "";
            var link = "";
            var caption = "";
            var picture = "";
            var fbMessage = "";
            var accesstoken = "";
            var rootLink = "";
            var actionName = "";

            foreach (var field in message.Field)
            {
                if (field.key == "targetFacebookId")
                    targetFacebookId = field.value;
                if (field.key == "userNameCaption")
                    name = field.value;
                if (field.key == "link")
                    link = field.value;
                if (field.key == "caption")
                    caption = field.value;
                if (field.key == "picture")
                    picture = field.value;
                if (field.key == "fbMessage")
                    fbMessage = field.value;
                if (field.key == "accesstoken")
                    accesstoken = field.value;
                if (field.key == "actionName")
                    actionName = field.value;
                if (field.key == "rootLink")
                    rootLink = field.value;
            }
            var fb = new FacebookService(accesstoken);
            log.Info("posting to facebook target:" + targetFacebookId);

            var res = fb.StreamPublish(name, link, targetFacebookId, caption, picture, fbMessage,  rootLink,actionName, rootLink);

            return res;
        }