[ROYALINE’s] SharePoint Dynamics

SharePoint Development & Techniques

how to hide a sharepoint list column from a list form new edit and display

Posted by Freelance-Puma on September 28, 2011


Posted in Uncategorized | Leave a Comment »

How to add a new item to a SharePoint list using Javascript and the Lists.asmx web service

Posted by Freelance-Puma on August 12, 2011


I had a brilliant idea at the beginning of the year. I am the Site Collection Administrator and am only responsible for administering and developing solutions for my SharePoint site collection in my office (about 2000 employees). I do not have access to the SharePoint servers to install WSP’s, use STSADM, or even PowerShell.

I am in charge of all development for my Site Collection but getting a custom SharePoint web part or WSP solution into production takes weeks….and sometimes months. So, i began working with the Content Editor Web Parts (CEWP’s) to see if I can use the SharePoint Web Services and Javascript as a “Poor man’s” web part. My “Poor man’s” web parts are only CEWP’s which don’t have to go thru a special code review and approval process before being moved into the production SharePoint farm.

If you are under these same kind of restrictions, maybe you’d like to consider this approach as well. However, this isn’t the best approach in that things can ‘break’ easily if someone modifies your code in the CEWP’s.
Read the rest of this entry »

Posted in CEWP, Javascript, Lists.asmx, SharePoint, SharePoint 2007, SharePoint Hacks, Site Collection, Web Services, XML | 2 Comments »

Connecting to the SharePoint ‘Lists.asmx’ web service without having to manually create a Web Service Reference

Posted by Freelance-Puma on August 11, 2011


Up until recently I have been manually adding a Web Service Reference to my WinForms and WPF projects. I have been connecting to the SharePoint Web Services to pull data from my sites because of the limitations of not having access to the server to use the SharePoint Object Model. In an ideal situation, I would much rather use the SharePoint Object Model to access SharePoint data because I can do more with it and it’s not as complicated as using the SharePoint Web Services.

I’ve often wondered how I can reference the ‘lists.asmx’ web service without having to manually add a Web Service Reference in Visual Studio. Following this approach, you can call a web service (any web service) from your WinForms, WPF, Javascript, ASP.NET, etc. applications. Read the rest of this entry »

Posted in C#, Lists.asmx, Object Model, SharePoint, SharePoint 2007, Web Services, XML | Leave a Comment »

Using an XML “settings” file to store values for your SharePoint projects

Posted by Freelance-Puma on August 11, 2011


I recently created a SharePoint timer job solution that relied on the data in a list as to what the function of the job was to do. The solution requirement was to have a timer job set to run at 8:00am every Thursday that would read SharePoint list data and create a customized email of that data for the week.

Since I work in an environment with multiple SharePoint farms, I had to rely on a ‘settings’ file that I could easily change without having to recompile and redeploy my WSP solutions. I will show you how to read the nodes and values of an XML file located in a SharePoint list that your SharePoint solutions can reference, thus eliminating the need to recompile your code for each SharePoint farm. Let’s get started…
Read the rest of this entry »

Posted in C#, Object Model, SharePoint, SharePoint 2007, Site Collection, WSP, XML | Leave a Comment »

How to use the Content Editor Web Part to build a dynamic link based on your current URL

Posted by Freelance-Puma on August 11, 2011


Believe it or not, this is a very useful piece of code. I use it often in my content editor web parts to get the URL of the site I’m currently on.

To be more specific, I use this code to get the URL of the site, then modify it to dynamically create a URL that points to the LISTS.ASMX web service. Why is this useful? Consider the following:

  1. I have a custom list at the root site collection that is readable by everyone.
  2. The list contains a link to a custom web part page that is located on each site (subsite) in my site collection. The web part page is just a blank page that has a few CEWP’s (content editor web parts) in different zones.
  3. One of the CEWP’s only function is to get the URL of the site, then does a javascript ‘split’ to get each element of the URL. This is necessary to build a custom URL that points to the ‘LISTS.ASMX’ web service for the site I’m on.
  4. Once I have the new URL (that has been modified to point to the ‘lists.asmx’ web service), I can then query my sites schema (including list schema) for the site.

I find this to be VERY useful in that I can get a listing of all lists and libraries for a site and view the XML schema behind them, all bundled up in a single report. Instead of going thru each site and each site’s lists one at a time, I can view the XML schema from a single ‘web part page’.

So, to get started, I’m going to show you how to get the URL from a site. Let’s begin by assuming you are on a SharePoint site at this URL: Read the rest of this entry »

Posted in CEWP, Javascript, SharePoint, SharePoint 2007, SharePoint 2010, SharePoint Hacks | 1 Comment »

How to use a Content Editor Web Part to get the value of a query string

Posted by Freelance-Puma on August 11, 2011


I often use query strings in SharePoint web parts, links, lookup columns, etc., and have found this bit of code to be very useful when having to display content on my page based on the value of a query string parameter. Here’s an example of how to get the value of a query string parameter by using JavaScript:

Read the rest of this entry »

Posted in CEWP, Javascript, SharePoint, SharePoint 2007, SharePoint 2010, SharePoint Hacks | Leave a Comment »

How to display an error if an unsupported browser views your SharePoint site

Posted by Freelance-Puma on August 11, 2011


When I create web parts for my SharePoint sites, I try to make it a good practice to detect what browser is viewing my site and then display a message if it is not supported.

For instance, the company I work for only supports Internet Explorer. I am able to use other browsers in my organization but the content on any web page is only guaranteed to be displayed correctly within IE. All other browsers may or may not display the information correctly, so IE is the only option I have to work with.

So, I often use Content Editor Web Parts to display content on my site, especially if I am using javascript to query my SharePoint sites for data (using the SharePoint web services). However, if a user goes to one of my sites and gets errors or has improperly formatted data, I have to instruct them on the company’s policy to use IE only to view the site. In most cases, this doesn’t go over well.

To use this code example, add the code to a Content Editor Web Part on your site (I usually put it at the top): Read the rest of this entry »

Posted in CEWP, Javascript, SharePoint, SharePoint 2007, SharePoint 2010 | Leave a Comment »

God is SO good to me!

Posted by Freelance-Puma on February 4, 2011


I cannot express my gratitude to God enough for his amazing, continued mercy and grace He has extended to me. I thank you so much Lord for forgiving me and not destroying me with a bolt of lightning when I do something that breaks your heart. Read the rest of this entry »

Posted in Personal | Tagged: | Leave a Comment »

How to register a javascript script block in a SharePoint Application Page

Posted by Freelance-Puma on September 29, 2010


Since a SharePoint application page references a master page file, all javascript needs to reside in the master page. However, when creating an application page to be used within your SharePoint environment, you’ll need to register a client script block. Read the rest of this entry »

Posted in ASP.NET, C#, Javascript, SharePoint | 2 Comments »

Getting all items in all folders using the Lists.asmx Web Service

Posted by Freelance-Puma on April 22, 2010


One of the oddest things i’ve seen recently (for me anyway) was the sudden inability to get all items in all folders on an old WSS 2.0 SharePoint Site Collection.

One of my smaller site collections contains around 2000 items, including Folder items. In order to prepare for a manual migration to MOSS 2007, i am having to inventory all items and properly move them to their correct location in the new MOSS environment.

My initial attempt to get all items in all these lists was to use the standard “GetListItems” method of the Lists.asmx web service, but for some reason not all items were being returned. Read the rest of this entry »

Posted in SharePoint, Web Services | 2 Comments »