Search This Blog

Sunday, September 21, 2014

SharePoint Collection QA

What is Business Connectivity Services in SharePoint ?
SharePoint 2010 provides a new set of technologies known as Business Connectivity Services for retrieving, editing, updating, and deleting data from external systems(for e.g. data from ERP or CRM database). BCS enhances the SharePoint platform’s capabilities with out-of-box features, services and tools that streamline development of solutions with deep integration of external data and services.
How is BCS Different from BDC in SharePoint 2007 ?

Even though the BDC made it relatively easy to create read-only solutions that display data in the Business Data List Web Part, it was not so simple to create a solution that enabled users to make changes and write that data back to the external store.

BCS, on the other hand, provides you with Read-Write capable connectivity from Client and Server to Database, WCF/Web Services and .Net Sources.

A Developer can now use SharePoint Designer 2010 and VS 2010 rapid development tools to access external data. For e.g. you can now create read-write connections to external database from SharePoint designer and then can create webpart\other solutions to surface that data.

The BCS data can further be used in other SharePoint Fetaures such as Business Intelligence,Collaboration and in Enterprise Search.

Choosing Between ASP.NET 2.0 Web Parts and Windows SharePoint Services 3.0 Web Parts

Office SharePoint Server 2007 and Windows SharePoint Services 3.0 are built on top of the ASP.NET 2.0 Framework. Windows SharePoint Services 3.0 uses the ASP.NET 2.0 Web Part infrastructure to take advantage of features such as master pages and custom Web Part development while providing a complete set of Windows SharePoint Services features, such as document services, events, workflow, search, site columns, content types and more.

You can build Web Parts for Windows SharePoint Services 3.0 in two ways:

* Create custom ASP.NET 2.0 Web Parts.

* Create SharePoint-based Web Parts.


Decision matrix for creating Web Parts

Create a custom ASP.NET 2.0 Web Part
 
·         For most business needs.
·         To distribute your Web Part to sites that run ASP.NET 2.0 or SharePoint sites.
·         When you want to reuse one or more Web Parts created for ASP.NET 2.0 sites on SharePoint sites.
·         To use data or functionality provided by Windows SharePoint Services 3.0. For example, you are creating a a Web Part that works with site or list data.

Create a SharePoint-based Web Part
·         When you want to migrate a set of Web Parts using the SharePoint-based Web Part infrastructure to Windows SharePoint Services 3.0.
·         To create cross page connections.
·         To create connections between Web Parts that are outside of a Web Part zone.
·         To work with client-side connections (Web Part Page Services Component).
·         To use a data-caching infrastructure that allows caching to the content database.
·         Although not recommended, there may be times when you need your code to perform certain functions that the current user does not have the necessary permissions to perform.
The SPSecurity class provides a method (RunWithElevatedPrivileges) that allows you to run a subset of code in the context of an account with higher privileges than the current user.
The premise is that you wrap the RunWithElevatedPrivileges method around your code. And also In certain circumstances, such as when working with Web forms, you may also need to set the AllowSafeUpdates method to true to temporarily turn off security validation within your code. If you use this technique, it is imperative that you set the AllowSafeUpdates method back to false to avoid any potential security risks.

Code example

{
SPSite mySite = SPContext.Current.Site;
SPWeb myWeb = mySite.OpenWeb();
//Using RunWithElevatedPrivileges
SPSecurity.RunWithElevatedPrivileges(delegate()
{
// Get references to the site collection and site for the current context.
// The using statement makes sures these references are disposed properly.
using (SPSite siteCollection = new SPSite(mySite.ID))
{
using (SPWeb web = siteCollection.OpenWeb(myWeb.ID))
{
web.AllowUnsafeUpdates = true;

try
{
//Your code
}
 
web.AllowUnsafeUpdates = false;
//siteCollection = null;
//web = null;
}
·         SSP Vs Service Applications
·         Differences between SSP and Service Application are :

What are :
 

SSP :
 A Web application that contain all the services proived by sharepoint, and can be shared by various web applications. Some of the services are Search, Infopath,User Profiles etc.
Service Application :
 The Services that use to be together in SSP, now run independently as a Service Application.

Build -In :

SSP :
 Shared Services Provider (SSP) was only a part of Office SharePoint Server 2007.

Service Applications :
 The service application architecture is however, built into MicrosoftSharePoint Foundation 2010 itself.


SSP Administration Site :

SSP :
 They require a SSP administration site to configure the associations with web applications.

Service Application :
 They are running independently and can be individually associated with the one or more web applications.


Web application's Burden :


SSP :
 Any Web application associated with the SSP has to take the burden of all the shared services in that SSP.

Service Application :
 Each web application now have a "Service application group" where they can just add the Services that they need.

Replication :
 

SSP :
 The Services where configured in SSP itself and were not replicated. All web applications will use one set of srevices.

Service Application :
 If the service is needed to be shared between few web applications, the service is re-configured and added into each web application's custom service connection group.
·         In Sharepoint Object model there are two Important namespaces.

In SharePoint 2007 - The
 Microsoft.Office.Server namespace is the root namespace of all Office Server objects and Microsoft.SharePoint is the root namespace for all WSS objects.
Hive
 :
In SharePoint 2007 - It has
 "12 hive" structure where all SharePoint resources are deployed.
In SharePoint 2010 -
 Microsoft has apparently added three new folders to its hive and calling it as "14 Hive"
* UserCode – files used to support sandboxed solutions
* WebClients – used for the client Object Model
* WebServices – New .svc files
Foundation :
SharePoint 2007 : Wss 3.0 was required for accessing all common SharePoint API's
SharePoint 2010 : SharePoint Foundation 2010 is required to provide base API's.
API's
 :

SharePoint 2007 : No API was available for Code to Interact with SharePoint site through Client side scripts (side Note : You can do it by calling Sharepoint web services using javascript )

SharePoint 2010 : MS has introduced
 Microsoft.SharePoint.Client namespace that enable you to interact with SharePoint sites through scripts that run in the browser from Microsoft .NET Framework managed code, and inside Microsoft Silverlight applications.

How to Export & Import Web Parts in SharePoint

While blogging my continuing investigation into whether or not it's possible to deploy a My Site Web Part into a Team Site yesterday, I promised a step-by-step look at my latest nugget of SharePoint learning.  That nugget?  How to export a Web Part from one site and import it to another site within a site collection.  So as to continue the learning process, I aim to answer another question that has since occurred to me regarding the exporting/importing of Web Parts, and that question is: When you export/import a Web Part that's already been configured, do all of your existing settings come along for the ride?  I'll put my cards on the table and say outright that I'm assuming the answer to this question is yes, so let's find out together, shall we?
For the purpose of this experiment, I'm going to use the World Clock & Weather Web Part that's on my My Site (since, as a result of my ongoing investigation, I already know that I won't be able to use any of the My Site-specific Web Parts), and I'll begin by selecting the Export... item from the dropdown menu in the upper right of that Web Part:
http://community.bamboosolutions.com/resized-image.ashx/__size/725x0/__key/CommunityServer.Blogs.Components.WeblogFiles/sharepoint_5F00_blank/ExportMenuItem.jpg
Clicking that Export... button brings up the following message:
http://community.bamboosolutions.com/resized-image.ashx/__size/725x0/__key/CommunityServer.Blogs.Components.WeblogFiles/sharepoint_5F00_blank/ExportFileDownload.jpg
After choosing the Save option, I'll choose where to download the DWP file (desktop probably being the handiest option since once I've imported it, I'm just going to delete the file anyway.  Note:  In some cases, the name of the Web Part may be different than the name of the DWP file, so don't be alarmed) on the resulting screen.
Once I've saved the World Clock & Weather Web Part DWP file to my desktop, I'm going to navigate to another site in our collection, the site where I want to import the Web Part.  I'll be heading to our team's site because, well, I have edit rights there.  Once I've chosen the page to which I want to import the Web Part, I'm going to first select Edit Page from the Site Actions dropdown menu on that page and then, once in Edit Mode, I'll click an Add a Web Part button on the page.  Clicking that button will bring up the Add Web Parts popup, and here I'll choose the Advanced Web Part gallery and options hyperlink at the bottom of the page.  Doing so will render the Web Part task pane at the right of the page in Edit Mode, and clicking the dropdown button in the Browse section of that pane will provide the Importoption I seek:
http://community.bamboosolutions.com/resized-image.ashx/__size/725x0/__key/CommunityServer.Blogs.Components.WeblogFiles/sharepoint_5F00_blank/BrowseImport.jpg
Clicking the Import option will refresh the task pane with the Import view, in which I'll simply browse to the DWP file on my desktop and then click Upload:
http://community.bamboosolutions.com/resized-image.ashx/__size/725x0/__key/CommunityServer.Blogs.Components.WeblogFiles/sharepoint_5F00_blank/ImportUpload.jpg
Once the upload is complete, the task pane will refresh with a new section, confirming the Uploaded Web Part and providing placement options for its importation onto the page:
http://community.bamboosolutions.com/resized-image.ashx/__size/725x0/__key/CommunityServer.Blogs.Components.WeblogFiles/sharepoint_5F00_blank/UploadedWebPart.jpg
Just as you would expect, after choosing the placement and then clicking the Import button will place the imported Web Part on the page in the desired location ... and guess what?  The version of the Web Part which gets imported does indeed retain all of the configuration options from its original location.  Sweet!




No comments:

Post a Comment