Archive | 2009

DisableEventFiring() or EnableEventFiring() programmatically on a List or Document Library from anywhere


The credit for figuring this out goes to Paul and here is the original blog http://unclepaul84.blogspot.com/2007/12/disable-event-firing-in-sharepoint-when.html I had used in workflows and application page without any issues in past 6 months… If you need to disable event firing in sharepoint from anywhere except event handler and would like to .DisableEventFiring() or .EnableEventFiring() bcoz its available […]

Modify fields of an InfoPath Form Programmatically


1: const string _InfoPathTemplateLocation = @”http://moss2007/ctype/myFormLibrary/FormServerTemplates/myForm.xsn”; 2: const string _InfoPathPI_mso_infoPathSolution = “name=”urn:schemas-microsoft-com:office:infopath:myForm:-myXSD-2008-08-07T17-35-58″ solutionVersion=”1.0.0.316″ productVersion=”12.0.0.0″ PIVersion=”1.0.0.0″ href=”” 3: + _InfoPathTemplateLocation + “””; 4: const string _InfoPathPI_mso_application = “progid=”InfoPath.Document” versionProgid=”InfoPath.Document.2″ />”; 5: const string _InfoPathPI_mso_infoPath_file_attachment_present = “”; 6:  7: private void createmyForm() 8: { 9:  10: MemoryStream msSr = new MemoryStream(); 11:  12: xmlTextWriter = new XmlTextWriter(msSr, […]

consuming WCF service in InfoPath form:The remote server returned an unexpected response: (405) Method Not Allowed.


    I was consuming a WCF service with wsHttpBinding in web based infopath form. This error drove me nuts for sometime and adding myService.svc to http://server:8371/ on the client fixed the issue. I was using the service inside code behind creating channel on the wcf service. My next post would publish steps to integrate […]

Creating custom application pages with OOTB styles overridden(/_Layouts/)


  While creating a layouts page , you would like to add/override styles in your ASPX page. To override styles, Use the IE toolbar to find the exact style you would like to override. Place the styles as below  in the ContentPlaceHolderId="PlaceHolderAdditionalPageHead" and id="AdditionalPageHead". You could add display:none for the style to disappear on your […]

WSP Deployment gets Stuck at "Deploying"


I had this problem a few days back and I had all the options in the stsadm command to deploy it immediately, like -immediate and stsadm -o execadmsvcjobs Apparently it was the problem with one of the servers in the server farm was down. Since the faulty server is there in the server farm, STSADM […]

Creating RoleDefinitions, UserGroups and RoleDefinitionBindings


Create a RoleDefinition as per the permissions you would like that role to have. I would create "Reader " with below roledefinition 1: SPRoleDefinition readersRoleDefinition = new SPRoleDefinition() 2:{ 3: Name = "Readers", 4: Description = "My site collection Readers", 5: BasePermissions = 6: SPBasePermissions.ViewListItems | 7: SPBasePermissions.OpenItems | 8: SPBasePermissions.ViewVersions | 9: SPBasePermissions.CreateAlerts | […]

Core.js: Disable ECB menu items in Document library or List based on permissions. …mystery solved…


Create a custom core.js from the original core.js as described in this link: http://msdn.microsoft.com/en-us/library/cc768565.aspx  Follow the steps below and you can hide ECB items based on permissions i.e. SPBasePermissions like you could disable some ECB menu items as below… Disable the send menu as below by commenting AddSendSubMenu 1: if (currentItemFSObjType !=1) 2: { 3: […]