Monday, December 21, 2009

SPQuery returning all items in list

I ran into a rather simple error today while attempting to query a list using CAML. When I used SPQuery to query a list for particular items, all the items in the list was getting returned. I found out why !

I forgot to take off the Query element tag off the CAML before using it running an SPQuery on a list.

Wednesday, November 18, 2009

CRM 4.0 URL issue while opening Word document

Today, I came across a peculiar Page Not Found issue.

I have been working on a piece of functionality that would grab the value selected by a user from a drop down box and generate a Word document based on the selected template. This generated Word document will then be saved to the file system and a prompt be made available for the user to Open, Save, or Cancel.

While I was developing and debugging the ASPX page that provided the selection of the template name, everything was working fine. The document was generated, saved, and the user prompt was appearing.

After I published my ASPX page to the CRM web site, I customised the ISV.config to add a button which will initiate my custom ASPX page.

The button would take the user to : http://mysite/industries/

Every time I pressed the button, the ASPX page loaded up fine until I selected a template and pressed the 'Generate' button. Internet Explorer gave me a 'Page not found' error.

Initially, I thought there was something stopping the code from running since it is now integrated with the CRM web site. But I suddenly had an idea to change the URL I had placed onto the CRM button.

Instead of having - http://mysite/industries/
I changed it to this - http://mysite/industries/default.aspx

And BAM !!!!!!!!!!! That was it ! Now, it works as it should in the first place and behaves the same way as when I was debugging it using Visual Studio.

Tuesday, November 10, 2009

ErrorScript error message when pasting content into a content editor webpart/control in SharePoint

I have been receiving a ErrorScript message while attempting to paste content I have copied into a Content editor web part / or a publishing content text field.

REASON: I am led to beleive that the security settings on my internet browser this from happening. I changed the browser that I was using, and this message prompt appeared:


I selected 'Allow access' and my content was pasted.

I selected 'Don't allow' and the words ErrorScript was pasted






This image shows the ErrorScript message I was experience while attempting to paste content.


















Issue Resolved !!!!

Monday, May 11, 2009

Error while moving web part between web part zone

Set position:relative for the body element in the page.

Alternatively, place position:relative in a CSS file for the body element of the page.

In CSS file:

body
{
...
position:relative;
}

Thursday, March 5, 2009

Ultimate Trouble Shooting Alternate Access mapping guide

Error Show Case 1


  • Contains host file entry
  • Contains IIS Identity
  • Contains invalid or no alternate access mapping in Operations (Central Administration).


Error Show Case 2






  • Contains Host file entry
  • Contains Alternate Access Mapping in Operations (Central Administration)
  • Contains no identity entry in IIS


Error Show Case 3



  • Contains no host file entry
  • Contains no alternate access mapping
  • Contains no identity entry in IIS


Successful alternate access mapping outcome



  • Contains host file entry
  • Contains alternate access mapping
  • Contains identity entry in IIS

SPBasePermissions listing

Specifies the built-in permissions available in Windows SharePoint Services.

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx

SharePoint List template IDs

List Template ID List Type

100   Generic (custom) List
101   Document Library
102   Survey
103   Links List
104   Announcements
105   Contacts
106   Events
107   Tasks
108   Discussion Board
109   Picture Library
110   Data Source
111   Site Template Gallery
113   Web Part Gallery
114   List Template Gallery
115   Form Library
119   Wiki Page Library
120   Generic (custom) List in Datasheet view
150   Project Tasks
200   Meeting Series List
201   Meeting Agenda List
202   Meeting Attendees List
204   Meeting Decision List
207   Meeting Objectives List
211   Meeting Things to Bring List
212   Meeting Workspace Pages List
300   Portal Sites List
850   Pages List (Publishing site)
1100  Issue Tracking
2002  Personal document library
2003  Private document library

Changing the New! gif in a custom list

If you are implementing a custom list in a site definition, you can easily update the icon that SharePoint puts next to newly created items in a list. Instead of the New! icon, you can replace it with other gifs.

Go to your schema.xml and locate the following section:



Replace the relative src link with another image. Make sure that you provision your custom gif with your site definition to the /_layouts/1033/images folder when you redeploy your list.

Wednesday, March 4, 2009

Monday, March 2, 2009

Alternative method for attaching javascript event handlers to a text box for IE6 compatibility

Attaching event handlers OnFocus and OnBlur work ok under IE6/IE7, and FireFox if its done this this way:

txtSearchText.Attributes.Add("onfocus","ClearTextBox()"); txtSearchText.Attributes.Add("onblur", "RepopulateTextBox()");

BUT this way does not work under IE6:

control.onfocus = function() { ClearTextBox(); }
control.onblur = function() { RepopulateTextBox(); }

Thursday, February 26, 2009

Remember to Serialize objects when saving to web part properties

Remember to set the [Serializable] attribute to the web part property you are using to save your data when saving objects, e.g. saving objects to an arraylist web part property.

Strings do not require the [Serializable] attribute to be specified.

Monday, February 23, 2009

Associated PDF file type with PDF icon

1. Find or Create an icon file you want to use (16x16 pixels)

2, Copy the icon file (.gif) to the location: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\IMAGES

3. Go up a level and go to the XML folder in the templates directory: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\XML

4. Open the DOCICON.xml file.

5. Go to the section

6. Go to the bottom of the section.

7. Add an entry for the PDF icon gif:

8. Save file and exit.

9. Perform an IISRESET


For pages with existing links you wish to have the icon attached to it, you will need to re-enter them in. Refreshing the page does not update the link with the icon you have specified.

Wednesday, February 18, 2009

Invalid Page Layout error





Issue was corrected after removing an extra ~ from the PublishingPageLayout values.

Tuesday, February 10, 2009

Content Place Holder issue


A place holder was placed inside another placeholder.......

Once the place holder was taken out of the other one, problem fixed.

Duplicate web parts, error, Get it working.

There may come a time when there is a requirement that a web part be used multiple times on a web page.

Often, depending on the behavior of the web part, the web part/s may function incorrectly.

There was a web part I developed and the business user needed it to be displayed more than once on a page. My web part contained JavaScript as well as server side code.

SOLUTION: A solution would be to attach the web part ID to each JavaScript method and call. Hence making each instance of the same JavaScript method unique. If you have two of the same web parts on the page, each of those web parts will have a different web part ID. Web Part A will be calling Web Part A JavaScript Method and Web Part B will be calling Web Part B JavaScript Method.

Also attach the web part ID to the RegisterStartUpScript name. This will prevent your second JavaScript overwriting your first JavaScript method. If this happens, you will get JavaScript errors if you try to do something on your first web part because the methods it needs to call are missing.

As long as methods all have unique names, and on post back you are checking for the EventArgument correctly. You can attach a hashed string containing the post back argument parameter '#' web part ID.

Monday, February 9, 2009

Temporary ASP.NET files cache causing errors

Files like CSS, master pages, CSS Adapters etc, get cached in the Temporary ASP.NET files. These files do not get updated regularly.

After a few site definition deployments, I realised that there was something going on because my master page files were not being picked up even though they have been deployed to the 12 Hive. Features were re-activated, CTRL+F5-ed the web site, still no fix.

So after clearing the temporary files located at:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files

The web site picked up the new files I deployed.

Master Page: Getting File not found error after the location of the master page has changed in the site definition project

This error appeared after the master page was moved locations in the Visual Studio project solution. I deployed the solution and refreshed the default page.

Clear the .Net Temporary files and other caches did not fix the error.


Solution:

After removing the site collection and recreating it fixed this issue.

Sunday, January 18, 2009

Web Part properties, error message: "The file is not checked out. You must first check out this document before making changes"

I was updating web part properties in code and I wanted to save them. I called
SetPersonalizationDirty(); after my code had updated the web part properties.


I got the following error message "The file is not checked out. You must first check out this document before making changes"

The reason for this error occuring is because I was calling the SetPersonalizationDirty(); on the OnLoad method. After I removed it and put it straight after my code which updated the web part properties, the web part worked fine and the page did not through the error message "The file is not checked out. You must first check out this document before making changes"

Saturday, January 10, 2009

SharePoint web services

Web services provided by SharePoint 2007 are:

http://server:5966/_vti_adm/Admin.asmx - Administrative methods such as creating and deleting sites

http://server/_vti_bin/Alerts.asmx - Methods for working with alerts

http://server/_vti_bin/DspSts.asmx - Methods for retrieving schemas and data

http://server/_vti_bin/DWS.asmx - Methods for working with Document Workspaces

http://server/_vti_bin/Forms.asmx - Methods for working with user interface forms

http://server/_vti_bin/Imaging.asmx - Methods for working with picture libraries

http://server/_vti_bin/Lists.asmx - Methods for working with lists

http://server/_vti_bin/Meetings.asmx - Methods for working with Meeting Workspaces

http://server/_vti_bin/Permissions.asmx - Methods for working with SharePoint Services security

http://server/_vti_bin/SiteData.asmx - Methods used by Windows SharePoint Portal Server

http://server/_vti_bin/Sites.asmx - Contains a single method to retrieve site templates

http://server/_vti_bin/UserGroup.asmx - Methods for working with users and groups

http://server/_vti_bin/versions.asmx - Methods for working with file versions

http://server/_vti_bin/Views.asmx - Methods for working with views of lists

http://server/_vti_bin/WebPartPages.asmx - Methods for working with Web Parts

http://server/_vti_bin/Webs.asmx - Methods for working with sites and subsites