Archive

Archive for the ‘SharePoint Products and Technology’ Category

Add properties to visual webparts sharepoint 2010

November 7, 2013 Leave a comment

Hi,
This post talks on how one can add custom properties to their SharePoint 2010 visual webparts. Microsoft has brought visual webparts for easing the developer life with SharePoint 2010 development. But when it comes to adding some custom properties for these webparts then there is bit of trouble hidden.
To troubleshoot this issue lets us dive in entities inside webpart project.

  • Inside the webparts folder of the project one can see following files (considering webpart name as “VisualWebPart1”):
  1. Webpart class “VisualWebPart1.cs” that is derived from webpart class
  2. User control file “VisualWebPart1UserControl.ascx” and its associated designer and .cs files

Since we think that merely writing the property and setting its attributes to WebBrowsable=true & Personalizable inside the usercontrol class (VisualWebPart1UserControl.ascx.cs) file will go ahead and add properties into webpart, but in reality this will not work.
So how we gonna do this?
Even though the above assumption of ours is true but its partially true. The fact is, before adding this property to user control class we should
http://www.lamber.info/post/2010/05/21/How-do-I-create-custom-properties-in-Visual-Web-Parts.aspx
http://onlinecoder.blogspot.in/2011/04/custom-properties-in-sharepoint-2010_7158.html

Advertisements

Dynamic and Editable GridView for SharePoint 2010

October 30, 2012 Leave a comment

Hi All,
This post of mine is kind of continuation my effort in developing of generalized utilities (specifically on grid layouts ).
Well here this time I had moved bit ahead and tried to develop an editable dynamic data grid which would be quite closure to what we get in datasheet view of SharePoint list. SharePoint 2010 is the targeted platform for this one.
For now I’m going to upload images of my latest buddy 🙂 Do have a look at it.
webparts custom properties in modal-dailogue

Add .net assembly to sharepoint 2010 package or solution

April 5, 2011 Leave a comment

hi,

here in today I would like to share a small but required thing while packaging sharepoint solutions. We usually require to bundle-up .net assemblies within a sharepoint solution(s). Microsoft Visual studio 2010 has made this thing very easy for packaging sharepoint 2010 solutions.

Please check the screen shots for the sameIn the solution explorer you can see an .net assembly( underlined red in color), I wanted to refer/add this assembly into the sharepoint solution (highlighted in dark black).

So I opened the package.package (double click it 🙂 ) as shown in screen shot.

Here on the wizard click on Advance tab (highlighted in red box below)

On opening of the tab gives option (inform of buttons) to add, edit, delete “Additional Assemblies”. The added assemblies are listed in the grid.

When we try to add new assembly it will give 2 options viz; Add existing assembly & Add assembly from project output

Now if you want to add assembly from your current project/solution then use second option & if you to refer to external assembly which is not part of your project then use first option.

In either cases if you want to register these assemblies into the web.config safe controls then there is provision for same 🙂

One most important thing to remember is: any assembly that you want to refer/add should be strong named (public token key) in order to add it to the GAC / assembly cache.

Additional Resource can be found at: Add & Remove Additional Assemblies

Get SPweb, SPList or Document Library from SPContentDatabase Class

April 5, 2011 1 comment

Hi,

This post is helpful for those who are trying to extract information from the SPContentDatabase class. This is usually required when one is creating custom timer job, base level features etc.

The following code is written for Custom timer job:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Administration; (must)
using Microsoft.SharePoint;

namespace TTKTimerJob
{

class TTKIssueTimerJob: SPJobDefinition
{

public TTKIssueTimerJob()
: base()
{ }

public TTKIssueTimerJob(string jobName, SPService service, SPServer server, SPJobLockType targetType)
: base(jobName, service, server, targetType)
{ }

public TTKIssueTimerJob(string jobName, SPWebApplication webApplication)
: base(jobName, webApplication, null, SPJobLockType.ContentDatabase)
{
this.Title = “TTK Issue Timer Job”;
}

public override void Execute(Guid targetInstanceId)
{

// get a reference to the current site collection’s content database
SPWebApplication webApplication = this.Parent as SPWebApplication;
SPContentDatabase contentDb = webApplication.ContentDatabases[targetInstanceId];
// Get the TimerJobList Name from the webApplication collection
SPSiteCollection timerSiteCollection = webApplication.ContentDatabases[targetInstanceId].Sites;
SPList timerJobList = null;
foreach (SPSite siteItem in timerSiteCollection)
{
#region code here: finds the List in rootweb
//assumes the existence of a site collection with an absolute URL of
//http://localhost/sites/sitecollection/subsite/Lists/abc and that this site collection has a Web site named subsite
//SPList xyz = siteItem.RootWeb.GetList(“list url here”);

//SPList xyz = siteItem.RootWeb.Lists.TryGetList(“list Title here”);
timerJobList = siteItem.RootWeb.Lists.TryGetList(“ListTimerJob”);
if (timerJobList != null)
{
// create a new list Item, set the Title to the current day/time, and update the item
SPListItem newList = timerJobList.Items.Add();
newList[“Title”] = DateTime.Now.ToString();
newList.Update();
break;
}
#endregion}

}

}

}

Pros and cons of shared web application pool in sharepoint

March 7, 2010 Leave a comment

This post is outcome of some un-usual yet unique stuff (since I never encountered it before) that happen when we were developing and deploying sharepoint application. The situation was as below:

We had several sharepoint applications running on the server. For few of the applications to be unique and distinct from others and to be running on port 80 of the same server, we assigned unique IP address to the individual SharePoint application. From the above details it looks like each sharepoint application is unique, distinct from each other even though they share the same port 80. But there was something wrong while creation, configuring these sharepoint applications. Below blocks can provide the clear picture of above discription.

Now as I said that even though the applications were clear, distint & unique still they were some problems, issues when any of the application was customized, configured to cater specific requirement. The customization and configuration required good enough server coding, webparts, utilities and updation of the web.config and other associated files of the webapplication. Even in certain cases we had added several directories and sub directories under the root directory of application in InetPub (virtual directory).

So since there was heavy customization into the sharepoint application, the changes in one sharepoint application was affecting functioning of other sharepoint application. The Administrator was really having some tough time because of this. The seriousness grew up such that it stopped other sharepoint applications that were used by large user group. We had good round of discussion because of that 😦  .

Finally we come together (me and the admin along with my manager) started investigating and analyzing the web application, our code, server settings, permissions on the server and on application. But nothing fruitful came out.

Being frustrated of this all I finally decided to investigate right from source codes and also started to compare the production server with my development server (since everything was working fine on our development environment). So while doing that I found this culprit called as Web application pool, actually I should not refer it culprit or damn since its very innocent and helpful stuff of basic sharepoint webapplication infrastructure.

The only difference that I found between development and production environment was of application pools. This is because the Production Sharepoint sites (2 or 3 i guess)  were running with a Shared Application Pool, while mine where with individual/separate applications pools for each application. I then tried do the same on my development environment and and made my observation concrete. 🙂

The very next day I happily called my administrator and asked him to allocate the separate application pool for our application and from there onwards there were no more issues.  🙂

Here is one similar post which I found in recent days: http://www.windowsnetworking.com/articles_tutorials/Working-Application-Pools-Internet-Information-Server.html

I’m planning write few details on this provided when I get enough time 🙂

Till the time happy sharepointing 🙂

Integrate Siebel CRM with SharePoint

November 15, 2009 7 comments

CRM - SharePointThis post talk all about my experiment of integrating siebel crm system (siebel-on-demand) with sharepoint portal (SharePoint 2007 – MOSS). This is something which I did year back for one of our esteemed client.

This was really a very challenging and exciting task which me and my team enjoyed a lot. (thanks to my fellow team mates)

Well now I will start with the details of the task and will explain the approach to crack the task and design the solution.

Objective: The Objective was to pull data from LOB application  (Siebel-On-Demand) in MOSS through the channel of Business Data Catalog (BDC) and display it in form of list.

Requisites: Access to Siebel-On-Demand Applications web service, MS.NET wrapper web service, xml Meta data file, SSP.

Approach: Since this was a very unusal task and in that I was new to sharepoint so in initial phase I was confussed and had lost my confidence. So in such situation as normal developer do, I deed the same i.e. I simply googled out for Siebel Integration with SharePoint  🙂 and to my surprise the very first article I got was from MSDN for the same.

This build my confidence and cracked my worry too. It is really nice article but unfortunately wasn’t suitable for my need 😦 . So I went back to my Manager and even to the client specifying that it was not going to be very easy task (the client smilingly noded that he is aware about that and hence it to us). But some how because of that article I was hopeful  that I will crack the solution for this requirement.

So I started good enough brain storming sessions (I like & really enjoy this activity). While understanding Siebel as a technology the first thing that strick to my mind was, the support for web services (for me this is most exciting stuff of I.T and thanks to Deobrat for that 🙂 ) and its ability to talk with other applications through them.

The very first thing which I deed was I wrote a asp.net application in which I invoked the siebel web service by consuming its WSDL files (this wasn’t that easy as I thought. But the help files which I got from siebel were very helpful). So eventually I was able to list the data into asp.net grid view through the web services of siebel.

So this made one point clear and that is: I need not need to do any configuration or customization on the siebel end(as specified in MSDN) for my things. But on other hand I need to write some asp.net application which could help me to generate the required xml metadata file of BDC which I can import into sharepoint and start displaying data.

So from this one more thing which I concluded was I need a wrapper around siebel web service which will make the above task easy and comfortable.

Following are the basic steps for getting siebel integration with SharePoint:
1. Download the WSDL (web service defi. language) files from your Siebel-On-demand site
2. Create a new ASP.NET web service project and include all the above wsdl files into this as a web-reference
3. Now Against each WSDL create new WebService file(.asmx) within it write webmethods like Get,Set / Select that will communicate with Siebel web methods(something like method overriding.)
4. Whatever data you extract from siebel via services will be required to be returned by your webmethods so that SharePoint can read them. So return the siebel data in for .net array types(string, int, dateTime).
5. Compile this project and deploy it or host it on IIS server.
6. Test the same through your browser, once that is done then start designing application definition file(ADF) against these hosted web services.
7. On successful creation of the same then upload it to the sharepoint server
8. Add BDC webparts to webpage and configure them against the above ADF’s

I’m planning to elaborate more on this very soon 🙂

Hide “My Site” and “My links”

October 12, 2009 Leave a comment

The question is how to hide “My Site” and “My links” gracefully?

For any normal web application developer (who has very little exposure to sharepoint tools and technology) hiding some links (specifically “My Site”) from the default.master page will be just setting its visibilty property to “false”. But doing like this is not a feasible solution.

Then the question arises how to play with  such links gracefully?

So for this all you need to go to the SSP under the central administration site that is associated with SharePoint web application for which you want to hide the links.

Inside the SSP:

Under “User Profiles and My Site” Header click on “Personalization services permissions” link

This will take you to the “Manage Permissions: Shared Service Rights”   Screen 🙂

here select the user for whom you want to disable the “My Site” and “My Links” feature and then click “Modify Permissions of Selected Users” link

which will take you to “Modify Permissions” screen.

Now uncheck the “Create personal site” checkBox to disable the above features 🙂

Please Note changes made here will be applied on the all of the webapplications associated with SSP where you performed this change.

Need less to say that “My Links” and/or “My Site” feature is available to sharepoint web applications which are associated to the SSP only. In short WSS 3.0 driven webapplications dont have such feature 🙂