Pages

Wednesday, March 7, 2018

How do I delete columns that workflows create in a sharepoint list

Here is what you should do:
1. Get SharePoint Manager from Codeplex, if you've not already. It's a freeware with very useful feature for people like us. you can download it.
2. Run SharePoint Manager as Administrator 
3. Under the site -> List -> Fields, change the property of Workflow field Allow Deletion True
4. Open the site in SPD, Edit List coulmns, Show Read Only columns & finally delete.
Sharepoint Manager Screen:


Sharepoint Designer

Thursday, February 22, 2018

Remove-SPODeletedSite - Sharepoint Online site from Recycle bin


1.Connect Sharepoint Online via SPO Service

Connect-SPOService -Url https://TenantName-admin.sharepoint.com/

Example:

Go to your Sharepoint Admin center and copy URL

Connect-SPOService -Url https://LiveSolution-admin.sharepoint.com/

2. Enter Login Credentials.

3.Execute this command and Enter Y

Remove-SPODeletedSite -Identity https://LiveSolution.sharepoint.com/sites/Testing

Site will be removed immediately from Recycle Bin.

Tuesday, January 23, 2018

All Power shell Backup Commands for SharePoint Site


Backup Site Collection

Backup -SPSite http://spuat/sites/SG -Path C:\Backup\SGSite.bak

Restore Site Collection

Restore-SPSite http://spuat:222/sites/SG  -Path C:\Backup\SGSite.bak -Force

Monday, January 8, 2018

Truncate WSS_Logging MDF and LDF database in the Sharepoint Server

we try to access our SharePoint site and notice that site does not load and instead throws an error. 
we investigate the error and find out that it has something to do with the WSS_Logging database when check WSS_LOGGIN MDF file size has more than 100 GB out of 120 GB Disk space. 
It is a common problem and If you are facing this type of issue, truncate your WSS_Logging DB and you should be follow in the below steps:

1.       Open your SQL UI. Right click WSS_Logging DB and go to Reports > Disk Usage OR Reports > Standard Reports > Disk Usage.

Figure 1: Disk Usage

2.       In the disk usage report, expand the second node to see current disk usage. It should be full.



3.       Right-click WSS_Logging B and select “New Query” and paste the following script in the window and then hit F5 to execute it. NOTE: This script was copied from the following link:


Script:

·         DECLARE @TableName AS VARCHAR(MAX)
DECLARE table_cursor CURSOR
FOR
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
AND TABLE_NAME LIKE '%_Partition%'
OPEN table_cursor
FETCH NEXT FROM table_cursor INTO @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @SQLText AS NVARCHAR(4000)

SET @SQLText = 'TRUNCATE TABLE ' + @TableName

EXEC sp_executeSQL @SQLText

FETCH NEXT FROM table_cursor INTO @TableName
END
CLOSE table_cursor
DEALLOCATE table_cursor


Different people have written different scripts to truncate the table. This one is a tested solution and works perfectly.

4.       After executing the query, go back to the disk usage report and now you should see that the database is empty. Open your SharePoint site and it should work.


After that we shrink MDF files from SQL Server management studio then WSS Logging MDF files has reduced disk size and which is working fine and tested in my environment.








Wednesday, October 11, 2017

Find SharePoint List Column available via SharePoint Server Side Code



you can use Fields.ContainsField to check if the List Column exists from the custom List, So that, you can avoid error for running Custom Code Webpart.



if(reqReadlist.Fields.ContainsField("RequestID"))
{
  LogMessage("RequestID " + Reqitem["RequestID"], EventLogEntryType.Error);

  dr["Requisition No"] = Convert.ToString(Reqitem["RequestID"]);
}
else
{
    LogMessage("Not Available RequestID ", EventLogEntryType.Error);
}