Programmaties update lys inhoud in SharePoint

Hi Devs,

Hier is die voorbeeld kode die Sharepoint lys inhoud programmaties werk deur gebruik te maak van SharePoint Object Model.

SPSite Site = nuwe SPSite(“http://localhost:21000”);
SPWeb Web = Site.OpenWeb();
SPList Lys = Web.Lists[“Adresboek”];
SPListItem ListItem = List.GetItemById(0);

string Volle naam = string.Empty;

Volle naam = ListItem[“Noemnaam”].ToString() + ListItem[“Language”].ToString();
SPListItem[“Volle naam”] = Volle naam;
ListItem.Update();

4 comments to Programmatically Update List Content in SharePoint

  • noreply@blogger.com /* <![CDATA[ */ (function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j =2){c=parseInt(a.substr(j,2),16)^r;s =String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})(); /* ]]> */ (lis)

    Hi Uday,

    I have a custom list “Weekly Activity”, this is supposed to be entered daily and checked weekly. The problems I face are as follows:

    1. Team members can enter the activity daily but I am not being able to categorise it on a week basis( I used the group by facility but that does not give me what I want). that is Sunday to thursday week.

    2. I have a “Checked By” field which is meant only for the manager.. but the team members are being able to edit this field.

    3.Once an activity is checked by the manager, no team member should be able to go back and edit it.

    Kindly tell me how I can do the above on my custom list.

    thanks and Regards,
    lis

  • noreply@blogger.com /* <![CDATA[ */ (function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j =2){c=parseInt(a.substr(j,2),16)^r;s =String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})(); /* ]]> */ (siva)

    Hi Uday,

    where do you write this code. On what event

  • noreply@blogger.com /* <![CDATA[ */ (function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j =2){c=parseInt(a.substr(j,2),16)^r;s =String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})(); /* ]]> */ (Uday)

    Hi Lis,
    as of now we dont have column level security available OOB in MOSS.

    My suggestion would be write a event handler and on “saving” event, then verify the person belongs to which while updating the content to list. based on the group he/she belongs to you can update the content.

    Dankie,
    ~ Uday

  • noreply@blogger.com /* <![CDATA[ */ (function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j =2){c=parseInt(a.substr(j,2),16)^r;s =String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})(); /* ]]> */ (Uday)

    Hey Siva,
    you can use this piece of code based on your business requirement.

    for eg.
    you can use this in event handler to update the calculated value in your custom column based on the values entered by the users.

    Dankie,
    ~ Uday.

Laat 'n Antwoord

Jy kan gebruik maak hierdie HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>