VBA - 设置Outlook 2010标记,然后转发电子邮件

时间:2017-10-12 13:51:51

标签: vba outlook outlook-vba outlook-2010

我正在寻找一些VBA,它会在所选的电子邮件中设置一个标志,然后将其转发到预定义的电子邮件地址。我已经能够使用以下VBA为邮件设置标记,但我不确定如何将转发过程添加到预定义的电子邮件地址。

Public Sub SetCustomFlag()

Dim objMsg As Object

With objMsg

.FlagRequest = "Assigned to JP " & objMsg.SenderName
.ReminderSet = True
.Save
End With

Set objMsg = Nothing
End Sub

1 个答案:

答案 0 :(得分:0)

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Facebook;

namespace PayPalAPISample
{
    public partial class facebooksync : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckAuthorization();
        }

        private void CheckAuthorization()
        {
            string app_id = "App Id";
            string app_secret = "App Secret";
            string scope = "publish_actions,manage_pages";

            if (Request["code"] == null)
            {
                Response.Redirect(string.Format(
                    "https://graph.facebook.com/oauth/authorize?client_id={0}&redirect_uri={1}&scope={2}",
                    app_id, Request.Url.AbsoluteUri, scope));
            }
            else
            {
                Dictionary<string, string> tokens = new Dictionary<string, string>();

                string url = string.Format("https://graph.facebook.com/oauth/access_token?client_id={0}&redirect_uri={1}&scope={2}&code={3}&client_secret={4}",
                    app_id, Request.Url.AbsoluteUri, scope, Request["code"].ToString(), app_secret);

                HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    StreamReader reader = new StreamReader(response.GetResponseStream());
                    string vals = reader.ReadToEnd();
                    foreach (string token in vals.Split('&'))
                    {
                        //meh.aspx?token1=steve&token2=jake&...
                        tokens.Add(token.Substring(0, token.IndexOf("=")),
                            token.Substring(token.IndexOf("=") + 1, token.Length - token.IndexOf("=") - 1));
                    }
                }
                string access_token = tokens["access_token"];
                var client = new FacebookClient(access_token);
                client.Post("/me/feed", new { message = "markhagan.me video tutorial" });
            }
        }

    }
}