Currently Browsing: Sharepoint

SharePoint Error: “The language-neutral solution package was not found”

Last night while developing an event listener custom list, I ran into this error, SharePoint Error: “The language-neutral solution package was not found” The solution to this problem is, Restart your visual studio. And it will be back to normal. Hope this helps
read more

Set Item level permission in sharepoint through coding

Here is the way we can add item level permission for a user on an item, SPRoleDefinition oUserRole; SPRoleAssignment oUserRoleAssignment; SPListItem itm; SPSite site = null; SPWeb web = null; string siteUrl = Request.Url.ToString(); site = new SPSite(siteUrl); web = site.OpenWeb(); SPGroup grp = web.Groups[groupname]; itm=web.Lists["Shared Documents"].Items[0]; oUserRole = web.RoleDefinitions.GetByType(SPRoleType.Administrator); oUserRoleAssignment = new SPRoleAssignment(loginName, emailId, userDisplayName, notes);//for user or oUserRoleAssignment = new SPRoleAssignment(grp);//for group oUserRoleAssignment.RoleDefinitionBindings.Add(oUserRole); itm.RoleAssignments.Add(oUserRoleAssignment); web.AllowUnsafeUpdates...
read more

Sharepoint site does not exists at mentioned URL

Hi Guys, While working on the Sharepoint, I came across this error “Sharepoint site does not exists at mentioned URL”. On searching something I found that we’ll have to change the URL under the Project Properties. Enter Sharepoint Site URL
read more

Impersonation in Sharepoint – MOSS/WSS

Here is the little code that you can use to impersonate any user in sharepoint. This will code will pretend that you are logged in as the user who is impersonated and will be allowed access to all the features and inherits all the rights for that person. This is mainly used to do something for which the impersonating person has rights and you other user do not have rights. SPWeb web = SPContext.Current.Web.Site.OpenWeb(); SPUser user = web.AllUsers[username]; SPUserToken userToken = user.UserToken; SPSite site = new SPSite(SPContext.Current.Web.Site.Url.ToString(), userToken); web = site.OpenWeb(); Here...
read more

Writing in Sharepoint log file

Below is an example on how to write to the SharePoint log files (located in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS folder). catch(Exception e) { Microsoft.Office.Server.Diagnostics.PortalLog.LogString(“Exception: {0} – {1}”, e.Message, e.StackTrace); }
read more
Page 1 of 3123