Monday, October 12, 2009

MOSS / WSS 3.0 Day by day backup on individual folder

Create .bat file on the web end server copy and paste the below:

Start

'by : Ahmad Madkhana 25/9/2009
@For /F "tokens=1 delims= " %%A in ('Date /t') do @( Set DayName=%%A ) @echo DAY = %DayName%
@echo off
echo ====================================================
echo Backup Script For Office SharePoint Server 2007
echo ====================================================
@echo off
if %DayName%==Sun RD D:\Backup\Sun /S /Q
if %DayName%==Sun MD D:\Backup\Sun
if %DayName%==Sun stsadm.exe -o backup -directory "\\servername\Backup\Sun" -backupmethod full -item "Farm" -overwrite

if %DayName%==Mon RD D:\Backup\Mon /S /Q
if %DayName%==Mon MD D:\Backup\Mon
if %DayName%==Mon stsadm.exe -o backup -directory "\\servername\Backup\Mon" -backupmethod full -item "Farm" -overwrite

if %DayName%==Tue RD D:\Backup\Tue /S /Q
if %DayName%==Tue MD D:\Backup\Tue
if %DayName%==Tue stsadm.exe -o backup -directory "\\servername\Backup\Tue" -backupmethod full -item "Farm" -overwrite

if %DayName%==Wed RD D:\Backup\Wed /S /Q
if %DayName%==Wed MD D:\Backup\Wed
if %DayName%==Wed stsadm.exe -o backup -directory "\\servername\Backup\Wed" -backupmethod full -item "Farm" -overwrite

if %DayName%==Thu RD D:\Backup\Thu /S /Q
if %DayName%==Thu MD D:\Backup\Thu
if %DayName%==Thu stsadm.exe -o backup -directory "\\servername\Backup\Thu" -backupmethod full -item "Farm" -overwrite
@echo off
echo completed

End

In this example backup folders are located on the server D:\Backup folder
inside this folder there should be 7 folders for each day.
schedule the backup to run daily, and the batch file will overwrite the old backup weekly.

Regards,
Ahmad Madkhana

Wednesday, September 16, 2009

Reduce Padding between SharePoint Web Parts

To reduce the spacing between a webparts just open Core.CSS file and search for “ms-PartSpacingVertical”:

And make it like this:

.ms-PartSpacingVertical
{
font-size:1pt;
margin-top:1px;
}



That is all.

Regards,
Ahmad

Monday, June 15, 2009

SharePoint designer Hit Counter not work after installing SP2

After deploying Sp2 in our MOSS 2007 servers, suddenly the hit counter shows X image.
I have googled the issue with no luck but the interesting that I found is: the hit counter amount is stored on a file on the same directory as following:
If you attached the counter to default.aspx page then the counter file is default.aspx.cnt
When I tried to open the CNT file using SharePoint designer I got the error that the file type is blocked by the administrator.

It seems that SP2 added the CNT file type to blocked file types on central administration.

So the solution is:
1- Go to central administration web application.
2- Navigate to operation tap.
3- Under security configuration click on blocked file type.
4- Delete cnt type and then click OK.

Now the counter should work fine, have fun.

Regards,
Ahmad

Saturday, April 11, 2009

Task List Edit Assigned To field

When I tried to add task item on Sharepoint 2007 programatically I got an error mentioed that the field is maybe read only.

So....

You can not do :
item["Assigned To"] = "administrator";
item["Assigned To"] = "administrator@domain.com";
item["Assigned To"] = "domain\\administrator";


Instead, you have to specify the user ID from the user's list:

item["Assigned To"] = 1;

But how to tell what ID does a user have?
The only way I know of is using the "Users" property of the SPWeb object.
Lets say you want to assign the field to "ahmad@domain.com" (you only know the email).

you can use the following code:

item["Assigned To"] = item.ParentList.ParentWeb.Users.GetByEmail("ahmad@domain.com").ID;

Sunday, April 5, 2009

Error:Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed

Problem: when I try to read xml file on the server through custom webpart on the portal ,it give below error.

“Error:Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.”

Cause: The default trust level on our test site is set to wss_minimal which does not grant us permissions to use the SharePoint Object Model from the code.

To solve this error :

There are three different ways to get over this permission problem: we can add our assembly to the GAC to run under full trust, change our web.config and set the trust level to Full, or create a custom trust level by modifying wss_minimaltrust.config with just enough trust to get our code working.
Web Part Deployment Options, the third option is the recommended approach we will take to resolve our problem.

You'll have to add these lines to the medium trust file (or a custom trust file):

<ipermission class="System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1">
< connectaccess>
< uri uri="http://myserver:myport/mysitecollection\mywebservice.asmx">
</connectaccess>
</ipermission>


The path of the trust files can be found in the web.config. In my case it was:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG

You can add multiple url's

Saturday, April 4, 2009

Create view that shows all Lists (With the same type) in the site collection

  1. Create your new Contenet type the have List type "item" name it "MyCustomContentType"
  2. create custom List Nameit "MyCustomList".
  3. Go to List setting and allow mange content type.
  4. Change the content type of "MyCustomList" to "MyCustomContentType".
  5. Save List as template.
  6. Open a Windows SharePoint Service v3 Team Site in SharePoint Designer.
  7. Insert a view on a the Announcements list with the Title, Body, and Modified fields.
  8. At the top of the Data Source Details task pane, click “MyCustomList” to open the data source properties for the current view.
  9. Click on Fields and remove all fields except ID, Title, Modified, and any of your custom link.
  10. Switch to code view, and search for DataSourceMode
  11. Change the value from List to CrossList
  12. Next search for selectcommand
  13. In the select command, type immediately after the opening quote, and leave the rest of the selectcommand as it. You should see something like this: selectcommand="<webs scope="'Recursive'"></webs><View> ...”
  14. Save the page and browse to it (F12).

Saturday, November 15, 2008

Sharepoint 2007 navigation error "page has been modified by another author"

It has been logged as a bug.

1- Go to Navigation and make a list of libraries that have been corrupted. (Look in the 'Selected Item' box at the bottom under Navigation and check the URL. Don't try save, just click Cancel.

2- Click on the document libraries in question, then Settings, Document Library or List Settings, Title Description and Navigation. Change the display on quick launch to No.

3- Open SharePoint Designer and go to the web site view. At the bottom of the website view screen, choose the Navigation option. Delete the main document libraries. Save and exit.

4- On your SharePoint site, go to View All Site Content, click on the unlinked document libraries from step 2 and relink them to the quick launch.