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


C# SPListItem类代码示例

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


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

示例1: MoveListItemCommand

 public MoveListItemCommand(SPListItem copyItem, string targetListName, List<string> siteColumnGroups, SPWeb web)
     : base(web)
 {
     _CopyItem = copyItem;
     _SiteColumnGroups = siteColumnGroups;
     _List = _SPWeb.Lists.TryGetList(targetListName);
 }
开发者ID:jjaramillo,项目名称:Jjaramillo.SP2013,代码行数:7,代码来源:MoveListItemCommand.cs

示例2: RenderNumberOfBids

        private void RenderNumberOfBids(SPListItem item)
        {
            if (item["NumberOfBids"] != null)
            {
                var bids = item["NumberOfBids"].ToString();
                NumberOfBidsLabel.Text = string.Format("{0} - <a href=\"#\" onclick=\"javascript:$('#auction-bid-history').slideToggle()\">Bid History</a>", bids);
                // build list of bids for this item
                var query = new SPQuery
                {
                    Query =
                        "<Where><Eq><FieldRef Name=\"Item\" LookupId=\"TRUE\"/><Value Type=\"Lookup\">" + item.ID +
                        "</Value></Eq></Where><OrderBy><FieldRef Name=\"Modified\" Ascending=\"FALSE\"/></OrderBy></Query>"
                };
                var bidHistory = SPContext.Current.Web.Lists[Constants.BidderListName].GetItems(query);

                BidHistory.Text = "<table cellpadding=\"4\" cellspacing=\"4\"><tr>";
                BidHistory.Text += "<th>Bidder</th><th>Bid Amount</th><th>Bid Time</th>";
                foreach (SPListItem bidItem in bidHistory)
                {
                    var bidderColumn = (SPFieldUser)bidItem.Fields.GetField("Bidder");
                    var bidder = (SPFieldUserValue)bidderColumn.GetFieldValue(bidItem["Bidder"].ToString());
                    BidHistory.Text += string.Format("<tr><td>{0}</td><td>{1:c}</td><td>{2}</td></tr>", bidder.User.Name, bidItem["Amount"], bidItem["Modified"]);
                }
                BidHistory.Text += "</tr></table>";
            }
            else
            {
                NumberOfBidsLabel.Text = "0";
            }
        }
开发者ID:bsimser,项目名称:spauction,代码行数:30,代码来源:ItemDetails.ascx.cs

示例3: assign_roles

        protected void assign_roles(SPWeb web, SPListItem item, SPListItem project, string field_name, string field_guid, SPRoleDefinition definition)
        {
            try
               {
               string value = project[field_name].ToString();
               SPFieldUserValueCollection field_user_value = (SPFieldUserValueCollection)project.Fields[new Guid(field_guid)].GetFieldValue(value);
               foreach (SPFieldUserValue user_value in field_user_value)
               {
                   if (user_value.User == null)
                   {
                       SPGroup group = web.SiteGroups.GetByID(user_value.LookupId);
                       bind_role(item, group, definition);
                   }
                   else
                   {
                       bind_role(item, user_value.User, definition);
                   }
               }

               }
               catch (Exception ex)
               {
               log(web.Site, "为项目【" + project["Title"] + "】的【" + field_name + "】的文档授权时发生错误", "错误", ex.ToString());
               }
        }
开发者ID:ricardocarneiro,项目名称:SharePoint-1,代码行数:25,代码来源:Project+Documents+Library+Event+Receiver.cs

示例4: TestCondition

 public TestCondition(SPListItem listItem, string fieldName, string op, object val)
 {
     this.listItem = listItem;
     this.fieldName = fieldName;
     this.op = op;
     this.val = val;
 }
开发者ID:NickGrattan,项目名称:NGCCustomActivities,代码行数:7,代码来源:TestCondition.cs

示例5: GetSPListItemData

        public void GetSPListItemData(SPListItem spItem)
        {
            //base.Init(spItem, AttachmentsLoadMode.Short);
            ID = spItem.GetFieldIntValue(ListItemDefaultFields.ID);
            Title = spItem.GetFieldStringValue(ListItemDefaultFields.Title);
            GUID = spItem.GetFieldGuidValue(ListItemDefaultFields.GUID);
            Created = spItem.GetFieldDateTimeValue(ListItemDefaultFields.Created);
            CreatedBy = spItem.GetFieldUserValueOrEmpty(ListItemDefaultFields.CreatedBy);
            Modified = spItem.GetFieldDateTimeValue(ListItemDefaultFields.Modified);
            ModifiedBy = spItem.GetFieldUserValueOrEmpty(ListItemDefaultFields.ModifiedBy);
            ContentTypeId = Convert.ToString(spItem.ContentTypeId);
            ContentType = spItem.ContentType.Name;
            SPContentTypeCollection ctsParentList = spItem.ParentList.ContentTypes;
            foreach (SPContentType ct in ctsParentList)
            {
                UlsLogging.LogInformation("SPContentType Name: {0} Id: {1}", ct.Name, Convert.ToString(ct.Id));
                //ContentTypes.Add(ct.Name, Convert.ToString(ct.Id));
            }
            if (spItem.ModerationInformation != null)
            {
                ModerationStatus = spItem.ModerationInformation.Status;
                ModerationComments = Convert.ToString(spItem.ModerationInformation.Comment);
            }
            //ListID = spItem.ParentList.ID;
            //ListTitle = spItem.ParentList.Title;
            //WebID = spItem.Web.ID;
            //WebUrl = spItem.Web.Url;
            UIVersionString = spItem[ListItemDefaultFields.UIVersionString];

            OriginInfo OriginInfo = new OriginInfo();
            OriginInfo.GetData(spItem.ParentList);
        }
开发者ID:dimanngo,项目名称:SharePoint13Helper,代码行数:32,代码来源:DefaultListItem.cs

示例6: SendMailWithAttachment

        public static void SendMailWithAttachment(SPListItem item, MailMessage message)
        {
            SmtpClient client = new SmtpClient();
            client.Host = item.Web.Site.WebApplication.OutboundMailServiceInstance.Server.Address;

            //nazwa witryny
            if (string.IsNullOrEmpty(message.From.Address))
            {
                message.From = new MailAddress(BLL.admSetup.GetValue(item.Web, "EMAIL_BIURA"),
                  item.Web.Title != null ? item.Web.Title : BLL.admSetup.GetValue(item.Web, "EMAIL_NAZWA_FIRMY"));
            }
            else
            {
                message.From = new MailAddress(message.From.Address, Format_SenderDisplayName(item.Web,message.From.Address));
            }

            //ustaw adres zwrotny
            message.ReplyTo = message.From;

            for (int attachmentIndex = 0; attachmentIndex < item.Attachments.Count; attachmentIndex++)
            {
                string url = item.Attachments.UrlPrefix + item.Attachments[attachmentIndex];
                SPFile file = item.ParentList.ParentWeb.GetFile(url);
                message.Attachments.Add(new Attachment(file.OpenBinaryStream(), file.Name));
            }

            client.Send(message);
        }
开发者ID:fraczo,项目名称:BR5,代码行数:28,代码来源:SPEmail.cs

示例7: Update_msg

 private static void Update_msg(StringBuilder msg, string procName, SPListItem task)
 {
     msg.AppendFormat("<li>zadanie# {0} klient: {1} procedura: {2}</li>",
         task.ID.ToString(),
         BLL.Tools.Get_LookupValue(task, "selKlient"),
         procName);
 }
开发者ID:fraczo,项目名称:Animus,代码行数:7,代码来源:ObslugaADO.cs

示例8: UpdateCommand

 public UpdateCommand(SPListItem item, SPWeb web, Dictionary<string, object> values)
     : base(item, web)
 {
     _NewValues = values;
     _OldValues = new Dictionary<string, object>();
     LoadOldValues();
 }
开发者ID:jjaramillo,项目名称:SP2010Samples,代码行数:7,代码来源:UpdateCommand.cs

示例9: Create_Forms

        private static void Create_Forms(SPListItem item, Array klienci)
        {
            SPList list = BLL.admProcesy.GetList(item.Web);

            string mask = BLL.Tools.Get_Text(item, "colMaskaSerwisu");

            foreach (SPListItem k in klienci)
            {
                if (string.IsNullOrEmpty(mask))
                {
                    if (BLL.Tools.Has_SerwisAssigned(k, "selSewisy", "ZUS-*"))
                        Create_New_GFR_K(item, "ZUS-*", list, k);
                    if (BLL.Tools.Has_SerwisAssigned(k, "selSewisy", "PD-*"))
                        Create_New_GFR_K(item, "PD-*", list, k);
                    if (BLL.Tools.Has_SerwisAssigned(k, "selSewisy", "PDS-*"))
                        Create_New_GFR_K(item, "PDS-*", list, k);
                    if (BLL.Tools.Has_SerwisAssigned(k, "selSewisy", "VAT-*"))
                        Create_New_GFR_K(item, "VAT-*", list, k);
                    if (BLL.Tools.Has_SerwisAssigned(k, "selSewisy", "RBR"))
                        Create_New_GFR_K(item, "RBR", list, k);
                    if (BLL.Tools.Has_SerwisAssigned(k, "selSewisy", "RB"))
                        Create_New_GFR_K(item, "RB", list, k);
                }
                else
                {
                    if (BLL.Tools.Has_SerwisAssigned(k, "selSewisy", mask))
                        Create_New_GFR_K(item, mask, list, k);
                }

            }
        }
开发者ID:fraczo,项目名称:Animus,代码行数:31,代码来源:GFR_Request.cs

示例10: GetGroupAccessData

 /// <summary>
 /// Метод, возвращающий права для группы по умолчанию, в зависимости от карточки и её статуса
 /// </summary>
 /// <param name="Group">Группа</param>
 /// <returns></returns>
 private static AccessData GetGroupAccessData(SPWeb Web, SPGroup Group, SPListItem Item, CardState State, List<string> Companies)
 {
     AccessData result = new AccessData();
     switch (Item.ParentList.Title)
     {
         default: break;
         case GlobalConstants.ListNames.ControlMeasures:
             {
             }
             break;
         case GlobalConstants.ListNames.Request:
             {
             }
             break;
         case GlobalConstants.ListNames.Inbox:
             {
             }
             break;
         case GlobalConstants.ListNames.Outbox:
             {
             }
             break;
     }
     return result;
 }
开发者ID:amiheenko,项目名称:MTSAccess,代码行数:30,代码来源:Access.cs

示例11: GetSPLibItemData

        public void GetSPLibItemData(SPListItem spItem)
        {
            base.GetSPListItemData(spItem);
            FileName = spItem.File.Name;
            FileSize = spItem.File.Length;
            FileUrl = spItem.File.ServerRelativeUrl;
            //FileRelUrl = spItem.File.Url;
            FileAbsUrl = Convert.ToString(spItem[LibraryItemDefaultFields.EncodedAbsUrl]);
            if (string.IsNullOrEmpty(Title))
            {
                Title = this.FileName;
            }
            CheckOutStatus = spItem.File.CheckOutStatus;
            if ((int)CheckOutStatus != 0)
            {
                CheckoutUser = new UserData(spItem.File.CheckedOutByUser);
                CheckoutDate = spItem.File.CheckedOutDate;
            }
            
            CheckinComment = spItem.File.CheckInComment;

            //DocumentIcon = SPUtility.MapToIcon(spItem.Web, this.FileName, string.Empty);



            //FileRef = spItem.File.Url;// spItem.GetFieldStringValue(LibraryItemDefaultFields.FileRef);
            //FileSize = spItem.File.Length;//.GetFieldStringValue(LibraryItemDefaultFields.FileSize);
            //FileName = spItem.File.Name;// spItem.GetFieldStringValue(LibraryItemDefaultFields.LinkFilename);
            //EncodedAbsUrl = Convert.ToString(spItem[LibraryItemDefaultFields.EncodedAbsUrl]);
            //ServerUrl = spItem.GetFieldStringValue(LibraryItemDefaultFields.ServerUrl);
            //DocIcon = spItem.GetFieldStringValue(LibraryItemDefaultFields.DocIcon);
            //FileInfo = spItem.File;//.GetFieldUserValueOrEmpty(LibraryItemDefaultFields.CheckoutUser);
            //CheckinComment = spItem.GetFieldStringValue(LibraryItemDefaultFields.CheckinComment);
        }
开发者ID:dimanngo,项目名称:SharePoint13Helper,代码行数:34,代码来源:DefaultLibItem.cs

示例12: Create_ctRB_Form

        public static void Create_ctRB_Form(SPWeb web, int klientId, int okresId, string key, SPListItem klientItem, Models.Klient iok)
        {
            Logger.LogEvent("Create_ctRB_Form", klientId.ToString());

            SPList list = web.Lists.TryGetList(targetList);
            SPListItem newItem = list.AddItem();

            BLL.Tools.Set_Value(newItem, "selKlient", klientId);
            BLL.Tools.Set_Value(newItem, "selOkres", okresId);
            BLL.Tools.Set_Text(newItem, "KEY", key);

            Models.Okres o = new Models.Okres(web, okresId);

            BLL.Tools.Set_Text(newItem, "Title", string.Format("Opłata za obsługę {0}", o.Nazwa));

            double om = BLL.tabStawki.Get_OplataMiesieczna(web, klientId);
            if (om > 0)
            {
                BLL.Tools.Set_Value(newItem, "colDoZaplaty", om);
            }
            else
            {
                BLL.tabStawki.Ensure_KlientExist(web, klientId);
            }

            newItem.SystemUpdate();
        }
开发者ID:fraczo,项目名称:Animus,代码行数:27,代码来源:tabRozliczeniaGotowkowe.cs

示例13: GetFieldValueUserCollectionEmails

        public string GetFieldValueUserCollectionEmails(SPListItem item, 
                                                        string fieldName)
        {
            string emails = "";

            if (item != null &&
                item.Fields.ContainsField(fieldName) &&
                item[fieldName] != null)
            {
                string fieldVal = item[fieldName].ToString();

                SPFieldUserValueCollection usersV =
                    new SPFieldUserValueCollection(item.Web, fieldVal);

                foreach (SPFieldUserValue uv in usersV)
                {
                    emails += uv.User.Email + "; ";
                }

                return emails;

            }
            else
            {
                return string.Empty;
            }
        }
开发者ID:hopenbr,项目名称:HopDev,代码行数:27,代码来源:SRMSharePointWorkflowUtil.cs

示例14: AddCompanyName

        public static string AddCompanyName(string temat, SPListItem item)
        {
            if (item != null)
            {
                if (item.ContentType.Name == "KPiR" || item.ContentType.Name == "KSH")
                {
                    int klientId = Get_LookupId(item, "selKlient");
                    if (klientId > 0)
                    {
                        BLL.Models.Klient k = new Klient(item.Web, klientId);
                        return string.Format("{0} {1}", temat, k.PelnaNazwaFirmy);
                    }
                }

                if (item.ContentType.Name == "Prośba o dokumenty"
                    || item.ContentType.Name == "Prośba o przesłanie wyciągu bankowego"
                    || item.ContentType.Name == "Rozliczenie podatku dochodowego"
                    || item.ContentType.Name == "Rozliczenie podatku dochodowego spółki"
                    || item.ContentType.Name == "Rozliczenie podatku VAT"
                    || item.ContentType.Name == "Rozliczenie z biurem rachunkowym"
                    || item.ContentType.Name == "Rozliczenie ZUS")
                {
                    int klientId = Get_LookupId(item, "selKlient");
                    if (klientId > 0)
                    {
                        BLL.Models.Klient k = new Klient(item.Web, klientId);
                        return string.Format("{0} {1}", temat, k.PelnaNazwaFirmy);
                    }
                }
            }
            return temat;
        }
开发者ID:fraczo,项目名称:BR5,代码行数:32,代码来源:Tools.cs

示例15: HandleSecurityRules

        public void HandleSecurityRules(SPListItem listItem, SPEventReceiverType eventType)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                SecuritySettings settings = listItem.ParentList.GetCustomSettings<SecuritySettings>(TVMCORPFeatures.TVS);

                if (settings == null) return;
                settings.Rules.Sort(delegate(Rule rule1, Rule rule2)
                {
                    return rule1.Order.CompareTo(rule2.Order);
                });

                foreach (Rule r in settings.Rules)
                {
                    bool ruleQualified = ValidateRule(r, listItem, eventType);
                    if (ruleQualified)
                    {
                        bool itemQuailfied = ValidateItem(listItem, r);
                        if (itemQuailfied)
                        {
                            ApplySecuritySettings(listItem, r);
                            break;
                        }
                    }
                }
            });
        }
开发者ID:chutinhha,项目名称:tvmcorptvs,代码行数:27,代码来源:SecurityEventReciever.cs


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