Showing posts with label SharePoint 2007. Show all posts
Showing posts with label SharePoint 2007. Show all posts

Tuesday, May 8, 2012

SharePoint Software Factory 2010

I found a free Visual Studio Extension helping SharePoint newbies, as well as experienced developers to create, manage and deploy SharePoint solutions without having to know every tiny XML and C# secret.

Key Features:
  • Get started with professional SharePoint development in less than 5 mins!
  • Use powerful wizards to create all important SharePoint artifacts
  • Fully integrated in Visual Studio
  • Refactoring of artifacts (i.e. Content Types)
  • Fully automated build system creates web solutions packages (“WSP”s) and deployment files 
  • Integrated Code quality checks in “Release” build (additional installs required)
  • All projects are self maintained, meaning that there is no dependency to having SPSF installed on the machine, when you just want to build, or continue development without SPSF
  • Standard VS2010 item templates for SharePoint development can be used together with SPSF projects, though the coding conventions have to be applied by the developers for these items
  • Extensive Help integrated in Visual Studio
  • Supports new SharePoint Visual Studio application structure but also “old” best-practice SharePoint Hive structure
  • Supports SharePoint 2007/2010 and Visual Studio 2008/2010
  • Upgrade existing SharePoint projects.
You can check this extension from link:
http://spsf.codeplex.com/

Monday, March 5, 2012

SharePoint Customization

When I tried to build site using sandbox, I found many restrictions. The better solution for most of these problems do a workarounds using out of the box controls and Web parts of the SharePoint.

I found site give us good solutions for building some modules with small customization of out of the box SharePoint Web parts and Controls with css and javascript functions:
http://usermanagedsolutions.com/SharePoint-User-Toolkit/default.aspx
It Contains solution for SharePoint 2007 and SharePoint 2010 Sample of them:
  • Color-Coding-Calendar-List:
    Display calendar with color depend on category of item in List
  • Pie and Bar Charts (Google Connector)
    Display chart using calendar chart depend on values in List
  • Easy-Tabs
    When added to a Web Part zone, the Easy Tabs automatically generate a tabbed interface, with one tab per Web Part present in the zone.
  • Cross-Site-List-Snapshot
    This script allows you to display in a SharePoint page a view taken from another site or site collection.
  • Tasks-Lists-Rollup:
    roll-up Web Part that displays items collected from multiple lists of the same type
  • Bookmarklet-Expand-Collapse-Web-PartsOn a SharePoint page:
    adds an expand/collapse button to each Web Part, next to the title.
  • Page-Redirect:
    This script allows you to redirect your users to another Web page (specified in the Target location), when they try accessing the current page.
  • Image-Rotator:
    The image rotator allows you to display on your page a picture randomly selected from a SharePoint picture library.

    You can use solutions and add more enhancement of it.







Thursday, November 10, 2011

SharePoint Publising Page Problem MOSS Page Setting Error - Value does not fall within the expected range

When try to access publishing page or page setting getting error “Value does not fall within the expected range” . This error only happens when you copy an aspx page using SharePoint designer from one server to another severs (development server to production server). Also if you copy pages in the same server and changed alternate access mapping url.

Solutions:

  1. You cannot copy and paste the aspx page using SharePoint designer. First, export the aspx page using SharePoint designer to a physical file.
  2. Open the aspx page with notepad and search on the “mso:PublishingPageLayout”. You will notice your development portal URL is there.
    <mso:PublishingPageLayout msdt:dt=”string”>http://xxxdevelopmenturl/_catalogs/masterpage/BlankWebPartPage.aspx, Blank Web Part Page</mso:PublishingPageLayout>
  3. Replace your development URL (xxxdevelopmenturl) to the production URL or remove http://xxxdevelopmentur and save it.
  4. Open your production site with SharePoint Designer and import the modified aspx page.

If you found this error in production server open site using SharePoint Designer go to TaskPane-->Hyperlinks and edit hyperlinks of layouts like above sample:
Replace:http://xxxdevelopmenturl/_catalogs/masterpage/BlankWebPartPage.aspx
By: /_catalogs/masterpage/BlankWebPartPage.aspx

Also you can fix programmatically check url:

http://support.microsoft.com/kb/953445

Also Check this if you found your any modifications Navigation setting aren't saved.
or an error like image below:

Thursday, June 9, 2011

Failure trying to synch site for ContentDB WebApp

Problem:
Periodical errors in the event log of a SharePoint 2010 server with the following error event descriptions:
Failure trying to synch site for ContentDB WebApp . Exception message was Cannot insert duplicate key row in object 'dbo.UserMemberships' with unique index 'CX_UserMemberships_RecordId_MemberGroupId_SID'. The statement has been terminated.
Cause:

Old references to non existing content databases in the synchronization job list.

Fix:
List databases which are not synced for more than two days
stsadm -o sync -listolddatabases 2

Delete old database references from the config db
stsadm -o sync -deleteolddatabases 2

Thursday, June 3, 2010

"Upload Multiple Documents" option is missing in IE

if you found "Upload Multiple Documents" option is missing in IE do the following steps:

1) Browse to your website at http:///_layouts/settings.aspx; you will need to login by providing a service account name & password or your site collection administrator account & password.

2) Once you login, click on 'Site Actions' menu.

3) Then, click on 'Manage Site Content and Structure'.

4) Click on any document library you want to upload or add files into. If you do not see the 'Upload' menu from the dropdown main menu between the 'New' and 'Actions' menu then you have this bug as well showing up on your server. Don't give up yet, there is a solution. Keep going through these steps!

5) Click on 'New' and select 'Item'.

6) You should now see the Upload Document page; under the input browse field there should be a link for 'Upload Multiple Files...', if you do not see this you will need to install either Office 2003 or Office 2007. If you do see it, click on it.

7) Now, you should see the multiple upload page that allows you to select multiple files. If you try to select one or several and click on the OK button, nothing will happen. No need to worry! There is a work around. Just keep reading to the next step.

8) On the hierarchy navigation you will have links something like this:

WebSiteName > Folder1 > Folder2

9) Click on the "Document Library" folder name; in our case it was Folder1. Basically its the folder you ended up in in step #4.

10) Now, did you notice anyting in your menu change? Now you should be able to see the Upload menu option between the 'New' and 'Actions' menu that you could not see in step #4.

11) Click on the 'Upload' menu and select 'Upload Multiple Documents'

12) Now, you will be back at the Upload document page where you were in step #7

13) Select one file or many and then click OK. Now it works!!! You should get an IE popup asking you that your about to upload files to your site, Click OK.

Saturday, March 13, 2010

Moss 2007 Site Action -> Site Settings have disappeared

For some unknown reason for the admin user of our Moss site (and all other users who had full control permissions) the Site Action -> Site Settings menu option have disappeared from the home page. I can navigate to it by going to mysite/_layouts/settings.aspx but I can't change anything it says I do not have permissions.

IF the user logged IS the Site Collection administrator and still gets theses access denied messages, your Content Database seems to be locked. This happens during backups or when backups go wrong (get interrupted for example)
stsadm -o getsitelock -url http://server_name

if it is not showing as 'none', it is locked. fix command:
stsadm -o setsitelock -url http://server%5Fname -lock none

Thursday, March 11, 2010

How to change the Maximum File Upload Size

When a custom master page is applied, editing a list in Datasheet View causes IE to just hang. I found this script hich solved my problem:
<script type="text/javascript">

function GCComputeSizing(GCObject)
{
if (TestGCObject(GCObject))
{
var fBIDI=(document.documentElement.currentStyle.direction=="rtl");
var lGCWindowWidth=document.documentElement.scrollWidth;
var lGCWindowHeight=(document.documentElement.scrollHeight>document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.documentElement.scrollHeight;

var lGCObjectOffsetLeft=0;
var lGCObjectOffsetTop=0;
if (fBIDI)
{
lGCObjectOffsetLeft=-180;
lGCObjectOffsetTop=120;
}
else
{
lGCObjectOffsetLeft=32;
lGCObjectOffsetTop=-2;
}
var lGCObjectWalker=GCObject.parentElement;
while (lGCObjectWalker !=document.body)
{
lGCObjectOffsetLeft+=lGCObjectWalker.offsetLeft;
lGCObjectOffsetTop+=lGCObjectWalker.offsetTop;
lGCObjectWalker=lGCObjectWalker.offsetParent;
if (fBIDI)
if (lGCObjectWalker.offsetLeft > 0)
break;
}
lGCObjectOffsetLeft+=GCObject.parentElement.offsetLeft;
lGCObjectOffsetTop+=GCObject.parentElement.offsetTop;
glGCObjectHeight=lGCWindowHeight - lGCObjectOffsetTop;
if (glGCObjectHeight > lGCWindowHeight)
glGCObjectHeight=lGCWindowHeight
if (glGCObjectHeight < cGCMinimumHeight)f
glGCObjectHeight=cGCMinimumHeight;
if (fBIDI)
{
glGCObjectWidth=lGCWindowWidth+lGCObjectOffsetLeft;
}
else
glGCObjectWidth=lGCWindowWidth - lGCObjectOffsetLeft;
if (glGCObjectWidth > lGCWindowWidth)
glGCObjectWidth=lGCWindowWidth;
if (glGCObjectWidth < cGCMinimumWidth)
glGCObjectWidth=cGCMinimumWidth;
}
}

</script>
place it after core.js in your master page.

How to change the Maximum File Upload Size

By default SharePoint allows a maximum file size of 50MB that can be uploaded into any document library. This might be too much as you might not want users downloading 50MB files over your LAN/WAN. To change the maximum file size
1. Goto SharePoint Central Administration > Configure Virtual Server Settings from Virtual Server List Page.
2. Select your server
3. Goto Virtual Server General Settings (in Virtual Server Management)
4. Change the value of the Maximum Upload Size in MB's.

If you increase the file size limit, your site might occassionally time out for users while they are uploading files. To accomodate this increase the default time out property for IIS.

Tuesday, February 23, 2010

DiscussionBoard ListView in onet.xml

When tried to create site definition and added ListView for DiscussionForum. Link of added Item redirected to the default Web page for the site intead of open.
<View List="Discussion Forums"
WebPartZoneID="Left" BaseViewID="0" WebPartOrder="3" Type="HTML" RowLimit="5"
/>

After investigation I found error occur if the XML parser cannot find a matching content type ID.

Solution:
add the ContentTypeID attribute together with the content type value "0x012001" to the View element code of the discussion Web part in the Onet.xml file:
<View List="Discussion Forums" ContentTypeID="0x012001"
WebPartZoneID="Left" BaseViewID="0" WebPartOrder="3" Type="HTML" RowLimit="5"
/>

Thursday, March 12, 2009

Announcing the Accessibility Kit for SharePoint (AKS) v2.0

Microsoft and HiSoftware are pleased to announce the release of the Accessibility Kit for SharePoint (AKS) v2.0. The AKS v2.0 provides an accessible development framework and significantly reduces the level of effort and knowledge needed by customers and partners to improve the accessibility of SharePoint based sites and applications.
You can download from url:http://www.hisoftware.com/

Thursday, March 5, 2009

Propagate Content Type Changes

There is a common problem of propagating changes to content types deployed via a Feature.
I found solution for this problem by extended stsadm wroted by Søren to propagate changes.
You will find extended stsadm in this url:
http://stsadm.blogspot.com/2008/05/propagate-content-type-changes.html

Sunday, March 1, 2009

ValidationGroup in SharePoint 2007

The situation

You have an ASP.NET control that contains validation controls in the masterpage or page layout for a publishing site (an ASP.NET login control for example). When you try to edit and check in a publishing page you receive the following error.
This page contains content or formatting that is not valid. You can find more information in the affected sections.

The problem
Even if you fill in all the required fields on the publishing page, the validation controls on the other ASP.NET controls prevent the page from saving.

The solution:
You have 2 solutions:
1. Put your control in EditModePanel
<PublishingWebControls:EditModePanel runat=server id="EditModePanel1" PageDisplayMode="Display">
<------------Your Control --------------->
</PublishingWebControls:EditModePanel>

2. Hide your validators in edit mode:
WebPartManager wp = WebPartManager.GetCurrentWebPartManager(Page);
if(wp.DisplayMode == WebPartManager.BrowseDisplayMode)
{
yourvalidator.Visible = true;
}
else
{
yourvalidator.Visible = false;
}

Thursday, February 12, 2009

Deleting content Types in Sharepoint 2007 (The content type is in use)

Sometimes when you try to delete content type you faced error: The content type is in use.

Finding Lists/Libraries using the Content Type:
  1. We need a tool like the SharePoint Explorer for WSS 3.0 (needs to be run on the WSS server itself) to figure out what the SiteCollection ID is.
  2. We need the ContentTypeID of the content type we want to delete, the easiest way to get this is right out of the URL when you go to delete (or edit) the content type (Site Settings->Site Content Types->Click on your content type).

    Here's a sample URL.
    http://w2k3-tyler-virt/_layouts/ManageContentType.aspx? ctype=0x010700037B79D2DD41C24A8F55D82FC6B71FAC&Source=http%3A%2F% 2Fw2k3%2Dtyler%2Dvirt%2F%5Flayouts%2Fmngctype%2Easpx
    In this example the Content Type ID is 0x010700037B79D2DD41C24A8F55D82FC6B71FAC
  3. Now connect content database
    run stored procedure
    [proc_ListContentTypeInUse] [SiteCollectionId], [ContentTypeId]Or in out case:
    [proc_ListContentTypeInUse] 'D2F8C831-4CA7-41C0-8497-82F897B61B2B', 0x010700037B79D2DD41C24A8F55D82FC6B71FAC

or run query:
SELECT SiteId, sys.fn_varbintohexstr(ContentTypeId) AS ID, WebId, ListId, IsFieldId, Class
FROM ContentTypeUsageWHERE (sys.fn_varbintohexstr(ContentTypeId) LIKE '[ContentTypeID]%')

Remove these records and error appears when you try to delete will disappear.

Friday, November 21, 2008

Programmatically determine the display mode or edit mode of a website

You have a WCMS website and want to programmatically determine if the whole website is in display mode or edit mode. The namespace

using Microsoft.SharePoint.WebControls;

offers the SPControlMode enumeration with the members:
  • Display
  • Edit
  • Invalid
  • New

You can check the current mode by using the SPContext.Current object:
if (SPContext.Current.FormContext.FormMode == SPControlMode.Edit)
{
}

If you want implement a custom WebControl you can use Microsoft.SharePoint.WebControls.SPControlMode.Display to determine if your custom WebControl is in display or edit mode.

Custom Alert Template

To customize alerts template:
  1. Create a working copy of AlertTemplates.xml. File Alerttemplates.xml is located at: Local_Drive\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\XML directory.
    Note Do not modify Alerttemplates.xml itself. Make changes to a working copy.
  2. Edit the working copy that you just created.
    Use the stsadm command to read the changed templates into the database. STSADM -o updatealerttemplates -url -filename .
  3. Restart IIS.
    Note It may be necessary to restart SharePoint Timer Services.

To assign a custom alert template to a specific list:

Create a new custom template with a unique Name attribute in your working copy of AlertTemplates.xml (You can copy paste the entire section with Name SPAlertTemplateType.GenericList, change the name and modify the sections you want to). Modify the template as necessary. After restarting IIS, write object model code to set the list alert template.
SPAlertTemplateCollection ats = new SPAlertTemplateCollection((SPWebService)(WebApplication.Parent)); //give appropriate values for WebApplication
list.AlertTemplate = ats["name from above"];
list.Update();

More information about Alerts Customization here

Friday, November 7, 2008

Embedding JavaScript in SharePoint Pages

The best method to embed custom javascript in SharePoint pages is to create a .js file and then include it in the SharePoint Page. If you would like to include javascript functions in the onload event of a sharepoint page, use the _spBodyOnLoadFunctionNames array. Include the push method in your script with the title of your function. The function should not include parameters...

<script>
function runOnLoad(){

}
_spBodyOnLoadFunctionNames.push("runOnLoad");
</script>

You found _spBodyOnLoadFunctionNames in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\INIT.JS

Tuesday, November 4, 2008

How to deploy a custom field with custom properties from a feature

When MOSS 2007 was still in beta and features and custom fields were new areas to discover we created the classic regular expression field type too, just to play with and learn the new technology.
Our implementation SPFieldRegEx was inherited from the Text type and had three custom properties defined in the field type definition XML:


<PropertySchema>
<Fields>
<Field Name="RegEx" DisplayName="Regular Expression" MaxLength="255" DisplaySize="15" Type="Text">
</Field>
<Field Name="MaxLen" DisplayName="Maximum length" MaxLength="3" DisplaySize="3" Type="Integer">
<Default>255</Default>
</Field>
<Field Name="ErrMsg" DisplayName="Validation message" MaxLength="255" DisplaySize="30" Type="Text">
<Default>The value does not match the regular expression</Default>
</Field>
</Fields>
</PropertySchema>

The RegEx property stores the regular expression pattern, the MaxLen controls the maximal length of the field content and finally, the ErrMsg holds the validation message to be displayed when the input text does not match with the regular expression.

There is nothing interesting in that up to this point, but if you would like to deploy this custom field using a feature setting custom values to the properties you might encounter some difficulty.

Since I haven’t found that documented neither in the WSS SDK nor on developer blogs in the past years, I decided to share my experience.If you create your feature definition for the field as you do normally with the built in field types, the result is the following XML:

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Field ID="{54634385-A8AC-4898-BF24-E533EB23444F}" Name="RegExField" DisplayName="RegExField" StaticName="RegExField" Group="Grepton Fields" Type="SPFieldRegEx" Sealed="FALSE" AllowDeletion="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3/fields" Description="This is the RegEx field" RegEx="[0-9]" MaxLen="20" ErrMsg="Error!"/>
</Elements>

But if you try to install the feature, you get the following error:

Feature definition with Id 6fd6ca04-3ac3-490f-b22f-4461a2253001 failed validation, file 'feature_definition2.xml', line 5, character 299:
The 'RegEx' attribute is not allowed.

If you remove the RegEx attribute, the same error message appears with MaxLen, if you remove that too, the ErrMsg causes problem.

So what to do to make this attributes allowed?The schema of the features is defined in the wss.xsd. Now the most important part for us is the FieldDefinition complexType that is responsible – what a surprise! – for describing the format of the field definitions in the features. Besides other things it contains the list of the allowed attributes.

<xs:complexType name="FieldDefinition" mixed="true">
...
<xs:attribute name="Decimals" type="xs:int" />
<xs:attribute name="Description" type="xs:string" />
...
<xs:attribute name="DisplayName" type="xs:string" />
...
<xs:attribute name="FillInChoice" type="TRUEFALSE" />
...
<xs:attribute name="Hidden" type="TRUEFALSE" />
...
<xs:attribute name="Max" type="xs:float" />
<xs:attribute name="Min" type="xs:string" />
...
<xs:attribute name="Name" type="xs:string" use="required"/>
...
<xs:attribute name="ReadOnly" type="TRUEFALSE" />
...
<xs:attribute name="Required" type="TRUEFALSE" />
...
<xs:attribute name="Title" type="xs:string" />
<xs:attribute name="Type" type="xs:string" use="required" />
...
<xs:attribute name="ID" type="UniqueIdentifier" />
<xs:attribute name="Group" type="xs:string" />
<xs:attribute name="MaxLength" type="xs:int" />
<xs:attribute name="SourceID" type="xs:string" />
<xs:attribute name="StaticName" type="xs:string" />
...
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>

The fragment above contains only the most widely used attributes for example.

One quick and dirty solution would be to include our custom attributes in the XSD schema but this probably wouldn’t be a supported method. Fortunately in this case MS has left the back door open: if you check the last attribute in the schema, it is anyAttribute with namespace ##other, meaning that you can inject your own attributes in the XML files using your own namespace.

After a minor modification in the feature definition XML (highlighted below) the XML was passed the schema check and our custom field feature was installed successfully.


<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
<Field ID="{54634385-A8AC-4898-BF24-E533EB23444F}" Name="RegExField" DisplayName="RegExField" StaticName="RegExField" Group="Grepton Fields" Type="SPFieldRegEx" Sealed="FALSE" AllowDeletion="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3/fields" Description="This is the RegEx field" xmlns:RegEx="[0-9]" xmlns:MaxLen="20" xmlns:ErrMsg="Error!"/>
</Elements>

But I faced another problem. Although this XML passed schema Validation, It didn't update extended attributes. After investigations I found only way to do that create event receiver for activation.

public class LookupFeatureEvents : SPFeatureReceiver
{
private const string CONST_FIELD = "Field";
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
string str = string.Empty;
string lastXml = string.Empty;
SPElementDefinitionCollection elementDefinitionCollection = properties.Definition.GetElementDefinitions(new CultureInfo(1033));
foreach (SPElementDefinition elementDefinition in elementDefinitionCollection)
{
if (elementDefinition.ElementType == CONST_FIELD)
{
XmlNode node = elementDefinition.XmlDefinition;
List<string> arrNS = new List<string>();
for(int i=0; i<node.Attributes.Count; i++)
{
if (node.Attributes[i].Prefix!=string.Empty)
arrNS.Add(node.Attributes[i].Prefix);
}
SPSite parent = properties.Feature.Parent as SPSite;
if (parent != null)
{
SPWeb web = parent.RootWeb;
string webid = web.ID.ToString("D");
string fieldId = node.Attributes["ID"].Value;
SPField lookup = web.Fields[new Guid(fieldId)];
lastXml = node.OuterXml;
for (int i = 0; i < arrNS.Count; i++)
{
lastXml = lastXml.Replace(arrNS[i] + ":", "");
}
lastXml = lastXml.Replace("xmlns=\"http://schemas.microsoft.com/sharepoint//"","");
lookup.SchemaXml = lastXml; lookup.Update(true);
}
}
}
}
public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
//throw new NotImplementedException();
}
public override void FeatureInstalled(SPFeatureReceiverProperties properties)
{
//throw new NotImplementedException();
}
public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
{
//throw new NotImplementedException();
}
}

Monday, November 3, 2008

An unhandled exception occurred in the user interface.Exception Information: OSearch (Administrator)

I was getting this error while trying to start the Office SharePoint Server Search service on a standalone dev machine that I was configuring. The machine was not a part of any domain so I would just enter the username for the search account without the domain name. To solve this error one needs to provide the MachineName\AccountName instead of AccountName for the search account to use

Friday, October 31, 2008

Browser Compatibilty forOffice SharePoint Server

The newer version of sharepoint , MOSS 2007 has better cross browser compatibility than the older version .It supports the following browswer :

Windows
Firefox 1.5+
Netscape 8.1+
Mozilla 1.7+

Macintosh
Safari 2.0+
Firefox 1.5+

Unix/Linux
Firefox 1.5+
Netscape 7.2+

Check out the following article to completely understand the browser compatibility:
http://technet.microsoft.com/en-us/library/cc263526.aspx

Tuesday, October 28, 2008

Restrict Anonymous Users to view Form Pages in MOSS 2007

If you enable the anonmous access in MOSS 2007 Site. The anonmous user will able to access the form pages like:
http://server/pages/forms/allitems.aspx

If you want to restrict anonymous users to access those default form pages.

Enable the ViewFormsPagesLockdown Feature to restrict anonymous users to access the site

Syntax:
stsadm.exe -o activatefeature -url -filename

Example:
stsadm.exe -o activatefeature -url http://server -filename ViewFormPagesLockdown\feature.xml