Showing posts with label MOSS 07. Show all posts
Showing posts with label MOSS 07. Show all posts

Sunday, March 20, 2011

Moving Files In SharePoint

SharePoint's SiteManager is a great tool to manipulate folders and files; however, it can sometimes fall short at times when a massive amount files need to be relocated. With proper permissions, you can get around this by using Windows Explorer instead. PLEASE NOTE: When moving a mass of files around in this manner, you can lose certain file details -- such as history data.

Moving Files in SharePoint Via Windows Explorer:

1. Open up your SharePoint page in internet explorer and copy the path (ie, http://dime/sites/yoursite).

2. Open up windows explorer and navigate to your web folders.

3. Right click on ‘Web Folders’ and select ‘New’.

4. Enter your path from step 1 and, like magic, you can drag and drop your files! :D

Tuesday, December 14, 2010

SharePoint's 12 Hive

Because, without a shortcut, I forget:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12

Sunday, December 12, 2010

Locating Your Current Context In SharePoint

To get your current location in SharePoint use:

SPControl.GetContextWeb(Context)

If you need to find the subweb, there is a web property in the SPWeb object you retrieved in the above code:

SPWeb currentWeb = Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(Context)

SharePoint Feature Deployment

1. Activate at farm level:
a. http://YourBox:33333/_admin/ManageWebAppFeatures.aspx
2. Activate at Site Collection level:
a. http://moss1/sites/YourSite/_layouts/ManageFeatures.aspx?Scope=Site
3. Activate at Site level :
a. http://moss1/_layouts/ManageFeatures.aspx?Scope=Site
b. http://moss1/_layouts/ManageFeatures.aspx
4. Activate at subsite level:
a. http://moss1/sites/YourSIte/SubSite1/_layouts/ManageFeatures.aspx
5. Turn feature on.

SharePoint Feature Stapling

Feature Stapling allows you to “staple” a Feature to a site definition without modifying it in any way. This means you can add your feature to all sites created using that site definition.

To create a staple, you actually create another Feature that does the stapling.

SharePoint Features: The Basics

  • Items that were previously contained within a large site definition file have been broken out as separate elements within Features. An element is an atomic unit within a Feature. A Feature.xml file typically points to one or more XML files whose top-level tag contains definitions for elements that support the Feature. Elements in Windows SharePoint Services 3.0 often correspond to what were discrete nodes in the Onet.xml or Schema.xml file of the previous version. There are several types of element—for instance, a custom menu item or an event handler.
  • A feature can provide the combined functions of elements.
  • To implement a Feature you add a subfolder containing a Feature definition within the Features setup directory (Local_Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES). The Feature subfolder includes a Feature.xml file that defines the base properties of the Feature and lists elements bound to it, such as XML files containing element manifests and any other supporting files. A Feature folder may contain only a Feature.xml file, or it may contain a Feature.xml file and any number of supporting element files, including XML files, but also .aspx, .htm, .xsn, .resx, .dll, and other file types.
  • When you create a folder within the Features directory through Windows Explorer by right-clicking a folder, pointing to New, and then clicking Folder, the new folder does not have inherited permissions. If you deploy a Feature in the folder, then some Windows SharePoint Services pages, such as for site settings or list views, throw an exception. You can fix this problem by right-clicking the new folder, click Properties, click Security, and then click Advanced. On the Permissions tab, delete uninherited permissions from the folder. You can also fix this problem by creating the new folder at the command prompt through the md command.
  • After creating the Feature folder, you can install and activate the Feature through command-line operations of stsadm.exe, or through the object model. You can also activate a Feature through the user interface. Installing a Feature makes its definition and elements known throughout a server farm, and activating the Feature makes the feature available at a particular scope.

SharePoint EventHandler Basics

NEW IN 3.0:

• You can use pre-synchronous and post-asynchronous modes to handle events.
• You can register events at the file, list, and Web site levels.
• You can register multiple events per item.
• You can cancel pre-synchronous events and display custom error messages.
• You can register item events on generic lists, as well as on document libraries.
• You can declaratively register events per list type or content type.
• In addition to trapping standard list item events (for example, ItemAdding, ItemDeleting, or ItemUpdating), you can trap schema events (such as adding, removing, or updating columns), as well as Web site and site collection deletion

CREATING AN EVENTHANDLER:

• Create an event handler assembly by creating a class library. Add reference to the Microsoft.SharePoint.dll and inherit from the Microsoft.SharePoint.SPitemEventReceiver base class:
Public class SimpleEventHandler : SPItemEventReceiver, …


REGISTERING AN EVENT HANDLER:

•.Add
•By list template ID
•Declaratively by content type

NOTE: must be strongly named and registered in the GAC.

Problem: The installation of features failed

ERROR: The installation of features failed during deployment of the solution

SOLUTION: Try to completely remove the feature via the command-line tool:
  • stsadm -o deploysolution -name "YourName.wsp" -url http://localhost:33333-immediate -allowgacdeployment -force
  • stsadm -o execadmsvcjobs

Problem: Failed To Find the XML File At Location

ERROR: Failed to find the XML file at location '12\Template\Features\YourName.Web\feature.xml'

SOLUTION: Delete 'white' bin folders in solution so that they will be forced to rebuild the feature.

Problem: Can't Open SharePoint Configuration Manager

ERROR: Application Server Administration job failed for service instance Microsoft.Office.Server.Search.Administration.SearchAdminSharedWebServiceInstance (6ffbc9de-581c-408a-b6c8-6912060b6517).

REASON: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

SOLUTION: iisreset

SPListItem.GetFormattedValue Snippet

public stringGetFormattedValue(string fieldName)

{
SPField field = this.Fields.GetField(fieldName);
if (field != null)
{
returnfield.GetFieldValueAsHtml(this[fieldName]);
}
return null;
}

.DWP vs .WEBPART

1. .DWP is for a SharePoint webpart
  • The post-build command line can use SafeGAC and go into the content site, not central admin. For example:

    set DllInstallTarget=SafeGAC
    set WspDeployTarget=http://Moss1
    set QuickModeTarget=Upgrade
2 .WEBPART is for an asp.net webpart

3. Both .dwp and .webpart have properties to be set for the "Custom" portion of the webpart's edit tool pane

4. Both have a Features section containing:
  • A class
  • A Feature.xml
  • Another .xml that corresponds to the Feature.xml and holds .resx properties.
5. Both .dwp and .webpart go into the web part gallery

6. With the .dwp, if a property changes then the webpart must be deleted and the feature de-activated before deploying the new version.

To Deploy A WebPart To SharePoint

1. At LEAST one of the following:
  • a. Assign a strong name
  • b. Mark the assembly with the AllowPartiallyTrustedCallers attribute
  • c. Configure the attribute inside your SharePoint site's web.config file.
2. Mark your assembly as a SafeControl inside of your SharePoint site's Web.Config file.

3. Add your web part library to the site's web part gallery.

4. Add web parts from your assembly to pages in your site.

Web Part Creation For ASP.NET 2.0 Portal Framework

1. Set a reference to System.Web.dll 2. Create a class that derives from System.Web.UI.WebControls.WebParts.WebPart 3. Override the Render method 4. (Optional) Strong name your assembly