Posts

"The Selected file was not found” Error When Adding an Attachment to an InfoPath Form

Adding the following bit of JavaScript to the WrkTaskIP.aspx page, which is responsible for hosting the InfoPath task form: <script type="text/javascript"> aspnetForm.encoding = "multipart/form-data"; </script> Another approach documented here suggests modifying the application.master master page file to add the necessary enctype form tag: <form runat="server" onsubmit="return _spFormOnSubmitWrapper();" enctype="multipart/form-data"> ... </form

Embedding InfoPath Form in SharePoint Page

Add the following line in the <SafeControls> tag of the web.config file of your web application in all servers: <SafeControl Assembly="Microsoft.Office.InfoPath.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.InfoPath.Server.Controls" TypeName="*" Safe="True" /> Open Portal. Under Site Actions, click Site Settings. In the Site Settings page click Web Part Gallery link. In the Web Part Gallery page , click New. We will be redirected to the Web Part Gallery : New Web Parts facility. In the Web Part Gallery : New Web Parts part, check Microsoft.Office.InfoPath.Server.Controls.XmlFormView . Then, click Populate Gallery. We will be redirected again to the Web Part Gallery page where we can verify the inclusion of XmlFormView.webpart. Now open the page where you want to add the infopath form In the Site Actions, click Edit Page. the page will be set to Edit Mode. Cli...

WebPart Life Cycle

1. OnInit: event used to create controls of web part 2. OnLoad: 3. CreateChildControls: event used to set properties and default values to controls collection If the page is being rendered for the first time the method generally occurs after the OnLoad event. If it is Postback, It is called before OnLoad event. EnsureChildControls: It checks to see if the CreateChildControls method has yet been called, and if it has not, calls it. 4. LoadViewState: The view state of the web part is populated over here. 5. OnPreRender: event used to set up business logic related work and in this routine controls value kept by viewstate 6. Render: event creates the HTML that appears in the body of the Web Part. 7. OnUnload: 8. Dispose:

Creating Views in SharePoint Using the object model

Using the object model we can create a SharePoint views programmatically. The query for the view uses an SPQuery which uses CAML. //Define an array to hold the columns required in the view String[] colArray = new String[] { "FName", "LName", "Email” }; //Add the array to a string collection StringCollection colCollection = new StringCollection(); colCollection.AddRange(colArray); //Define the query for the view String viewQry = “Your CAML Query Here’; HTML clipboard //Define the new view & Add to the List (100 is the item limit, true is allow paging and false is to set as the default view) SPView newView = YourList.Views.Add(“View Title”, colCollection, viewQry, 100, true, false);

How to modify the width and height of a Sharepoint Page Viewer web part dynamically

You can use following JavaScript code to dynamically adjust width and height of the page viewer web part. Just put it in each asp.net page that you want to display in a page viewer, and the problem will be solved: JavaScript code: function resizeMe(that) { window.resizeTo(document.body.scrollWidth, document.body.scrollHeight); } window.attachEvent("onload", function() { window.setTimeout("resizeMe()", 100); }); Alternatively, window.resizeTo(window.screen.availWidth, window.screen.availHeight); can also be used.

Adding Contact Selector Control to InfoPath form

The Contact Selector control is an ActiveX control but it is a special cased control, in that it can also be used in InfoPath browser forms. To use this control there are specific steps that need to be taken – let’s take a look at those now. Step 1 : Steps to add Contact Selector control to your Controls Task Pane 1) From the Controls Task Pane click "Add or Remove Custom Controls" link 2) Click the Add button 3) Add Custom Control Wizard select "ActiveX control" and click Next 4) This will display a list of controls , select "Contact Selector" ,click Next 5) Select “Don’t include a .cab file” and click Next 6) For Binding Property select Value and click Next 7) From the Field or group type box choose Field or group (any data type) and click Finish 8) Click Close and then click OK Step 2: Create the data structure for the Contact Selector Control The Contact Selector control needs to have a specific data structure to work properly – this is documented on...

Diff between Site Pages Vs Application Pages

Site Pages: Pages that support user customization are known as site pages and stored in the content database. Ex. Site pages default.aspx, NewForm.aspx, and EditForm.aspx. Site pages customization provides flexibility but can also impact performance and scalability Each page would also have to be individually parsed and loaded into memory.. Site pages do not support in-line code under the default security policy enforced by WSS. Application pages: Application pages do not support customization, which gives them two distinct advantages over site pages. First, each application page is always compiled into a single DLL so that it performs and scales better than a site page. Second, application pages are allowed to have in-line code. Ex. Settings.aspx, uagedetails.aspx. Application pages are deployed as physical files on file system of front end web server on the server's file system. An application page, such as settings.aspx, can be accessed by adding its relative path within the _...