Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static SPListItem GetItemById(string listname, int itemId)
- {
- String siteUrl = "http://sp:5872";
- SPSite spSite = new SPSite(siteUrl);
- SPList list = spSite.RootWeb.Lists[listname];
- SPListItem item = null;
- try
- {
- // init
- if (listname == null) { throw new Exception("SPList passed is null"); }
- item = list.GetItemById(itemId);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- return item;
- }
Add Comment
Please, Sign In to add comment