Tuesday, May 31, 2011
Javascript replace function
Example No. 1
var tempStr = "replace function is not working";
document.write(str.replace("not working", "working"));
Result tempStr = replace function is working
However one problem with replace function is that it only replaces the first substring found.
Example No. 2
var tempStr = "a1b1c1d1e1f1";
document.write(str.replace("1", "+"));
Result tempStr = a+b1c1d1e1f1
We need something like replaceAll function in this situation. replaceAll function doesnot exists but we have a work around.
Example No. 3
var tempStr = "a1b1c1d1e1f1";
tempStr = tempStr.replace(new RegExp("1", 'g'),"+");
Result tempStr = a+b+c+d+e+f+
Thursday, May 26, 2011
Open window in a new browser
It cant get any simpler than this
To view all my post, pleace click here
Code <a href="http://www.qaziarfeen.blogger.com" >here </a>
Code <a href="http://www.qaziarfeen.blogger.com" target="_blank" >here </a>
Using Button
Instead of hyperlinks, we can use HTML buttons as well and make them behave the same way as hyperlinks
Use the following code to test the behaviour to open page in the same window
<input id="btOpen1" type="button" value="Home" onclick="return ClearUrl();" />
<script type="text/javascript" >
function ClearUrl() {
window.location.href = "www.google.com";
}
</script>
Use the following code to test the behaviour to open page in a new window
<input id="btOpen1" type="button" value="Home" onclick="return ClearUrl();" />
<script type="text/javascript" >
function ClearUrl() {
window.open('http://qaziarfeen.blogspot.com'_blank');
}
</script>
Wednesday, May 25, 2011
Email Notification Delays in SharePoint 2007
I have already post on how to resolve it in SharePoint 2010. Here is a revision again
The timer interval service which sets this delay is called "job-investigation-alerts" This service send notifications out. The default timer interval is 5 minutes but we can of course change it using stsadm command
Open command prompt and browse to 12\bin and run the following command to identify if the job is running on the site
stsadm -o getproperty propertyname job-immediate-alerts -url < your-site-URL >
If you get Property Exists="Yes" and Value as some value defining the interval configured, it means that the service is running and you can change the interal using the following command
To set the property run the following command
stsadm -o setproperty -propertyname job-immediate-alerts -propertyvalue < A valid Windows SharePoint Services Timer service schedule > -url < your-site-URL >
Property Value can be set in the following manner
stsadm -o setproperty -propertyname job-immediate-alerts -propertyvalue "every 1 minutes between 0 and 59"
By running the above command you set the job to run every minute
References:
Tuesday, April 19, 2011
HTML iframe tag
Other attributes of IFRAME are
align: left; right; top; middle; bottom
Deprecated. Use styles instead.Specifies the alignment of an iframe according to surrounding elements
height: pixels; %
Specifies the height of an iframe
name: name
Specifies the name of an iframe
scrolling: yes; no; auto
Specifies whether or not to display scrollbars in an iframe
src: URL
Specifies the URL of the document to show in an iframe
width: pixels; %
Specifies the width of an iframe
Reference http://www.w3schools.com/
Monday, April 11, 2011
How to delete a Document Library in SharePoint
In SharePoint 2007 (MOSS 2007)
1. Go to the site where your library resides.
2. Click Site Actions>View All Site Settings 3. Click the Document Library that you want to delete. Once on the AllItems.aspx page of the library, select Document Library Settings from Settings Menu.
4. Under Permission and Management, click Delete this document library. 5. Once you click Delete this document library link, a confirmation will be poped up informing you that all the contents of this library will be deleted and sent to Recycle Bin of the site (depending on your deletion policy).
6. Press OK to delete the library.
In SharePoint 2010
1. Open SharePoint site on which your document library resides which you want to delete.
2. Click Site Actions> View All Site Contents menu.
3. Click the Document Library that you want to delete.
4. On the Library Tools tab, click Library.
5. On the Library tab under the Settings group, click Library Settings.
6. Click Delete this document library on the Document Library Settings page under Permissions and Management.
7. Click OK to confirm your action.
Monday, March 21, 2011
SharePoint Error: The path specified cannot be used at this time. Exception from HRESULT: 0x80070094
The path specified cannot be used at this time. Exception from HRESULT: 0x80070094.
On Microsoft Windows Server 2003 R2 Enterprise Edition with Service Pack 2 and MOSS 2007, I performed the following actions
1.Restart IIS
Click Start > Run
Type cmd and press Enter
Run command iisreset
2.Restart SharePoint Timer Service
Right click My Computer
Click Manage
Expand Services and Application
Click Services Restart Windows SharePoint Services Timer (Service Name SPTimerV3)
3.Restart Server (I didnot perform this action but it always works with Microsoft :)
Tuesday, February 22, 2011
How to Delete/Remove a Workflow from SharePoint Designer
How to enable SharePoint Designer Workflows
- Out of the box workflows
- SharePoint Designer workflows
- Custom workflows using Visual Studio and Workflow Foundation (WF)
- Open Central Administration.
- Click Application Management tab.
- Under Workflow Management Section, click Workflow settings.
- Make sure you have selected the web application on which you want to perform the operation
- Click Yes or No for "Enable user-defined workflows for this site?" depending on your requirement.
Wednesday, February 16, 2011
CAML Query and Where Clause Examples
I will also explain each of them a little. Keep visiting this post for more examples.
EQ: If you notice here, we don't have any "=" (equals to) sign. We have our equals to criteria wrapped inside EQ Tag.
<Where>
<Eq>
<FieldRef Name='Title'/>
<Value Type='Text'>Hello World</Value>
</Eq>
</Where>
AND: If we want to have data with a criteria which involves 2 or more column and a AND condition, this is how it looks in CAML. Notice we have all criteria nested inside AND
<Where>
<And>
<Eq>
<FieldRef Name='Title'/>
<Value Type='Text'>Hello World</Value>
</Eq>
<Eq>
<FieldRef Name='Column2'/>
<Value Type='Text'>CAML</Value>
</Eq>
</And>
</Where>
OR: OR schema is same as AND
<Where>
<Or>
<Eq>
<FieldRef Name='Title'/> <Value Type='Text'>Hello World</Value>
</Eq>
<Eq>
<FieldRef Name='Title'/><Value Type='Text'>Bye World</Value>
</Eq>
</Or>
</Where>
Greater Than: Any such operator can be used with or without AND/OR Clause
<Where>
<Gt>
<FieldRef Name='Age'/><Value Type='Text'>18</Value>
</Gt>
</Where>
Less Than: Any such operator can be used with or without AND/OR Clause
<Where>
<lt><FieldRef Name='Salary'/><Value Type='Text'>$5000</Value></lt>
</Where>
Order By: This clause is used independent of Where clause. If you do not define an order, default is ascending.
<OrderBy>
<FieldRef Name="Salary" Ascending="True"/>
<FieldRef Name="Age" Ascending="False"/>
<FieldRef Name="JoiningDate"/>
</Order>
<!--[if !supportLineBreakNewLine]-->
<!--[endif]-->
CAML Query SPQuery Object and Where Clause
SPList list = web.Lists["List Name"];
SPQuery query = new SPQuery();
query.Query = "<Where><Eq><FieldRef Name='Title'/><Value Type='Text'>Hello World</Value></Eq></Where>";
CAML Query
<Where><Eq><FieldRef Name='Title'/><Value Type='Text'>Hello World</Value></Eq></Where>
More on CAML in next post
Tuesday, February 15, 2011
Programmatically add records in a List in SharePoint
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite("SITE URL"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["LIST NAME"];
web.AllowUnsafeUpdates = true;
SPListItem item = list.Items.Add();
item["TITLE"] = "Hello World";
item.Update();
list.Update();
web.AllowUnsafeUpdates = false;
}
}
});
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite("SITE URL"))
{
using (SPWeb web = site.OpenWeb())
{
//do something there
}
}
});
http://vspug.com/spsherm/2007/08/17/spsite-vs-spweb/
http://www.15seconds.com/issue/050512.htm
list.Update();
Tuesday, January 25, 2011
How to identify which version of SharePoint you are using
- Go to Central Administration
- Click Site Actions
- Click Site Settings
- Under Site Information you will see that version is installed
- Run SharePoint 2010 Management Shell (Power Shell)
- Run the command get-spfarm | Select Products
SharePoint Foundation 2010: BEED1F75-C398-4447-AEF1-E66E1F0DF91E
Search Server Express 2010: 1328E89E-7EC8-4F7E-809E-7E945796E511
SharePoint Server 2010 Standard Trial: B2C0B444-3914-4ACB-A0B8-7CF50A8F7AA0
SharePoint Server 2010 Standard: 3FDFBCC8-B3E4-4482-91FA-122C6432805C
SharePoint Server 2010 Enterprise Trial: 88BED06D-8C6B-4E62-AB01-546D6005FE97
SharePoint Server 2010 Enterprise: D5595F62-449B-4061-B0B2-0CBAD410BB51
Search Server 2010 Trial: BC4C1C97-9013-4033-A0DD-9DC9E6D6C887
Search Server 2010: 08460AA2-A176-442C-BDCA-26928704D80B
Project Server 2010 Trial: 84902853-59F6-4B20-BC7C-DE4F419FEFAD
Project Server 2010: ED21638F-97FF-4A65-AD9B-6889B93065E2
Office Web Companions 2010: 926E4E17-087B-47D1-8BD7-91A394BC6196
Monday, January 24, 2011
Windows Phone 7 Challenge
Dear Students,
Windows Phone 7 Challenge is a competition to help students discover and cultivate their interests in the areas of Windows Phone 7 compatible applications development technologies. The competition is very demanding and inspiring and Students are required to design and develop Windows Phone 7 compatible applications to address the theme: Imagine a world where technology helps solve the toughest problems. You can design and develop applications from scratch, or develop or improvise on known Windows 7 applications.
Getting started is easy: In a four step procedure you will be eligible to participate in this competition:
Step one: Register yourself and your team (of up to four members).
Step two: Submit your Application Synopsis, which includes you XAP application, a short description of your team’s XAP application, including how it addresses the Theme “Imagine a world where technology helps solve the toughest problems”.
Step three: Submit your XAP Video following the outlined technical requirements and provide us the link to the video through the Contest Site, which should be uploaded on youtube. This Video should present your XAP application’s functionality or game play and provide an opportunity for your Team to explain the features as they are presented.
Step four: Your Team will present your XAP Application Source Code.
In round one, a team Pi Maxies from FAST National University of Computer & Emerging Sciences, Karachi won the contest. This proves that your participation will be nothing short of fruitful! Additional material is available on the contest site, including tools, e-books, help tutorials and videos.
Register for this student technology contest, MEA Windows Phone 7 challenge and in reward stand a chance to visitMicrosoft Corporation for five days! Also, you gain real life experiences, make new friends and an opportunity to turn your ideas into reality! Other prizes for winning students include cool devices like Notebooks and Netbooks!
For detailed information on the competition, registration and rules and regulations, tools to get started and other related news go to the MEA Windows Phone 7 Challenge.
Warm Regards,
Business Lead
Microsoft | Innovation Center – Pakistan
Thursday, January 20, 2011
Planning guide for sites and solutions for Microsoft SharePoint Server 2010, Part 1
AUC Technologies Offering Courses on Microsoft Technologies at Sir Syed University
- Visual Studio 2010 SP1 and .NET Framework 4.0
- ASP.NET 4.0, AJAX, ASP.NET MVC and LINQ
- Silverlight and Windows Phone 7
- SharePoint 2010
- Augmented Reality
- Entrepreneur and Blogging
- SQL Server 2008 R2
- Muhammad Atif Hussain
- Shayar Javed
- Usama Wahab Khan
- Umema Adil
- Mauhib Iqbal
Missing PDF Icon in SharePoint 2010
- Open folder [drive]\Program Files\Common Files\Microsoft Shared\Web server extensions\14\Template\Images.
- Copy PDF icon in this folder. (You can get PDF icon from http://www.adobe.com/misc/linking.html. It is recommended to download 17 x 17' )
- Stop IIS by running iisreset/stop on command prompt.
- Open folder [drive]\Program Files\Common Files\Microsoft Shared\Web server extensions\14\Template\Xml
- Make a copy of DocIcon.xml file.
- Open DocIcon.xml and add < Mapping Key="pdf" Value="[Name-Of-Icon-File.gif]" />
- Save and close DocIcon.xml file.
- Start IIS again by running iisreset/start on command prompt.
Open vs Save Dialog box in Document Library of SharePoint 2010
- Go to Central Administration
- Click Manage Web Applications
- Select the web application for which you want to change the default behavior
- Click General Settings from the top ribbon
- Scroll down to Browse File Handling
- Change the option from Strict to Permissive
- Click OK
Email Notification Delays in SharePoint 2010
stsadm -o getproperty
propertyname job-immediate-alerts
-url < your-site-URL >
stsadm -o setproperty -propertyname job-immediate-alerts -propertyvalue < A valid Windows SharePoint Services Timer service schedule > -url < your-site-URL >
Property Value can be set in the following manner