Problem in SharePoint Object model when accessing the sharepoint list items?

Up vote 0 down vote favorite share g+ share fb share tw.

Just I wrote using (SPSite site = SPContext.Current. Site) { using (SPWeb web = site.OpenWeb()) { //SPList lst = web. Lists"ManagerInfo"; SPList lst = web.

Listsstrlist; SPQuery getUserNameQuery = new SPQuery(); // getUserNameQuery. Query = "" + strRegion + "" + pmFName + "" + pmLname + ""; // getUserNameQuery. Query = "" + pmFName + "" + pmLname + ""; getUserNameQuery.

Query = "" + loginName + ""; SPListItemCollection items = lst. GetItems(getUserNameQuery); foreach (SPListItem item in items) { managerFName = item"Manager Name".ToString(); strAccounting = item"Accounting".ToString(); managerFName = managerFName. Replace(".

", " "); strAccounting = strAccounting. Replace(". ", " "); // isFound = true; XPathNavigator managerName = MainDataSource.CreateNavigator().

SelectSingleNode("/my:myFields/my:txtManagerName", NamespaceManager); managerName. SetValue(managerFName); XPathNavigator accountingName = MainDataSource.CreateNavigator(). SelectSingleNode("/my:myFields/my:txtAccountingName", NamespaceManager); accountingName.

SetValue(strAccounting); } } } I used this code in infopath this infopath is using by all users. Os when the current login user have no permissions to the list it showing error. When the current login user have full Permission it is working.

So Please advise me what can I do inorder to work them for all users. Sharepoint object model link|improve this question asked Apr 15 '10 at 10:51JanardhanReddy175 0% accept rate.

By using this using (SPSite site = SPContext.Current. Site){} You are disposing of SPContext.Current. Site which you should not do.

Taking Don's suggestion into consideration as well, try this SPSecurity. RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(SPContext.Current.Site. ID)) { using (SPWeb web = site.

OpenWeb(SPContext.Current.Web. ID)) { //SPList lst = web. Lists"ManagerInfo"; SPList lst = web.

Listsstrlist; SPQuery getUserNameQuery = new SPQuery(); // getUserNameQuery. Query = "" + strRegion + "" + pmFName + "" + pmLname + ""; // getUserNameQuery. Query = "" + pmFName + "" + pmLname + ""; getUserNameQuery.

Query = "" + loginName + ""; SPListItemCollection items = lst. GetItems(getUserNameQuery); foreach (SPListItem item in items) { managerFName = item"Manager Name".ToString(); strAccounting = item"Accounting".ToString(); managerFName = managerFName. Replace(".

", " "); strAccounting = strAccounting. Replace(". ", " "); // isFound = true; XPathNavigator managerName = MainDataSource.CreateNavigator().

SelectSingleNode("/my:myFields/my:txtManagerName", NamespaceManager); managerName. SetValue(managerFName); XPathNavigator accountingName = MainDataSource.CreateNavigator(). SelectSingleNode("/my:myFields/my:txtAccountingName", NamespaceManager); accountingName.

SetValue(strAccounting); } } } }).

Try to surround your code logic with : SPSecurity. RunWithElevatedPrivileges(delegate() { // insert code here }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions