当前位置: 首页>>代码示例>>C#>>正文


C# SPListItem.VerifyFieldAccess方法代码示例

本文整理汇总了C#中SPListItem.VerifyFieldAccess方法的典型用法代码示例。如果您正苦于以下问题:C# SPListItem.VerifyFieldAccess方法的具体用法?C# SPListItem.VerifyFieldAccess怎么用?C# SPListItem.VerifyFieldAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SPListItem的用法示例。


在下文中一共展示了SPListItem.VerifyFieldAccess方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendEmailbytemplateEx

        public static void SendEmailbytemplateEx(SPListItem item, SPListItem taskItem, List<NameValue> xvariables, SPListItem itemTemplate, string to, string cc, string variables)
        {
            List<EmailVariable> designerVariables = null;
            List<EmailVariable> bodyVariables = null;
            List<EmailVariable> subjectVariables = null;
            string subject = string.Empty;
            bool sendAsPlainMode = false;
            string body = EnsureAbsoluteUrl(item.Web.Site, itemTemplate["Body"].ToString());
            //string body = itemTemplate["Body"].ToString();

            if (itemTemplate["Subject"] != null)
                subject = itemTemplate["Subject"].ToString();

            bodyVariables = Parser.GetAndSetVariablesFromTemplate(body, item, taskItem);
            subjectVariables = Parser.GetAndSetVariablesFromTemplate(subject, item, taskItem);
            designerVariables = Parser.GetVariablesFromDesigner(variables);
            subject = Parser.SetValuesToContent(subject, subjectVariables, designerVariables);
            body = Parser.SetValuesToContent(body, bodyVariables, designerVariables);
            subject = ParseContentWithVariables(subject, xvariables);
            body = ParseContentWithVariables(body, xvariables);

            if (itemTemplate.VerifyFieldAccess("SendAsPlainText"))
            {
                sendAsPlainMode = Convert.ToBoolean(itemTemplate["SendAsPlainText"].ToString());
                if (sendAsPlainMode)
                    body = body.ToPlainText();
            }

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite site = new SPSite(item.Web.Site.ID))
                {
                    using (SPWeb web = site.OpenWeb(item.Web.ID))
                    {
                        StringDictionary headers = new StringDictionary();
                        headers = buidEmailHeaders(taskItem, to, cc, subject, sendAsPlainMode);
                        SPUtility.SendEmail(web, headers, body);
                    }
                }
            }
            );
        }
开发者ID:chutinhha,项目名称:tvmcorptvs,代码行数:42,代码来源:SendEmailHelper.cs

示例2: SendEmailByTemplateWithAttachments

        public static void SendEmailByTemplateWithAttachments(SPListItem item, MailAddress fromAddress, string to, string reply, string cc, SPListItem itemTemplate, List<Attachment> attachments, SPUser currentUser)
        {
            List<EmailVariable> bodyVariables = null;
            List<EmailVariable> subjectVariables = null;
            List<EmailVariable> designerVariables = new List<EmailVariable>();
            StringDictionary header;

            string subject = string.Empty;
            bool sendAsPlainMode = false;
            //string body = itemTemplate["Body"].ToString();
            string body = EnsureAbsoluteUrl(item.Web.Site, itemTemplate["Body"].ToString());
            if (itemTemplate["Subject"] != null)
                subject = itemTemplate["Subject"].ToString();

            bodyVariables = Parser.GetAndSetVariablesFromTemplate(body, item, null, null);
            subjectVariables = Parser.GetAndSetVariablesFromTemplate(subject, item, null, null);
            subject = Parser.SetValuesToContent(subject, subjectVariables, designerVariables);
            body = Parser.SetValuesToContent(body, bodyVariables, designerVariables);

            if (itemTemplate.VerifyFieldAccess("SendAsPlainText"))
            {
                sendAsPlainMode = Convert.ToBoolean(itemTemplate[new Guid("1BCADBD1-CC15-40A0-AAF7-6DE222412337")].ToString());
                if (sendAsPlainMode)
                    body = body.ToPlainText();
            }

            MailMessage message = new MailMessage
            {
                Subject = subject,
                Body = body,
                IsBodyHtml = !sendAsPlainMode,
            };

            message.From = fromAddress;

            // To mail
            string[] arrTo = to.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            foreach (string t in arrTo)
                message.To.Add(t);

            // CC mail
            if (!String.IsNullOrEmpty(cc))
            {
                string[] arrCC = cc.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                foreach (string c in arrCC)
                    message.CC.Add(c);
            }

            // Reply and body
            if (!string.IsNullOrEmpty(reply))
            {
                message.ReplyTo = new MailAddress(reply);
            }
            else
            {

                if (currentUser != null && !string.IsNullOrEmpty(currentUser.Email))
                    message.ReplyTo = new MailAddress(currentUser.Email);
                else

                    message.Body += "<br><br><i> System generated email, please do not reply to this message</i>";
            }

            foreach (Attachment a in attachments)
                message.Attachments.Add(a);

            // Send message
            //string server = SPContext.Current.Site.WebApplication.OutboundMailServiceInstance.Server.Address;
            //SmtpClient client = new SmtpClient(server);
            SmtpClient client = getSmtpInformation();
            client.Send(message);
        }
开发者ID:chutinhha,项目名称:tvmcorptvs,代码行数:72,代码来源:SendEmailHelper.cs

示例3: SendEmailbytemplate

        public static void SendEmailbytemplate(SPWeb web, SPListItem taskItem, SPListItem itemTemplate, string to, string cc, string variables, bool attachTaskLink)
        {
            string subject = string.Empty;

            //string body = itemTemplate["Body"].ToString();
            string body = EnsureAbsoluteUrl(web.Site, itemTemplate["Body"].ToString());
            bool sendAsPlainMode = false;

            if (itemTemplate.VerifyFieldAccess("SendAsPlainText")) //Fields.ContainsFieldWithStaticName("SendAsPlainText") && itemTemplate["SendAsPlainText"] != null)
            {
                sendAsPlainMode = Convert.ToBoolean(itemTemplate["SendAsPlainText"].ToString());
            }
            if (itemTemplate["Subject"] != null)
                subject = itemTemplate["Subject"].ToString();

            SendEmailbytemplate(web, taskItem, to, cc, variables, subject, body, sendAsPlainMode);
        }
开发者ID:chutinhha,项目名称:tvmcorptvs,代码行数:17,代码来源:SendEmailHelper.cs


注:本文中的SPListItem.VerifyFieldAccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。