delete etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
delete etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

2 Ekim 2012 Salı

Sharepoint 2010 - No content databases in the web application were available to store your site collection

Hi,
One of the weird behaviours of Sharepoint is that if you remove a site collection and restore it it would give the error "The operation that you are attempting to perform cannot be completed successfully. No content databases in the web application were available to store your site collection. The existing content databases may have reached the maximum number of site collections, or be set to read-only, or be offline, or may already contain a copy of this site collection. Create another content database for the Web application and then try the operation again."

The reason is that the deleted solution is not deleted, it is still in some sort of a Recycle Bin of SP, so if you d like to restore the SC, SP prompt you this error.

For example,
If you delete the SC from the Central Admin, you ll see the deleted site is still in somewhere.

You can see the deleted site with the command (PowerShell)

get-spdeletedsite

In order to delete this site properly, you can use one of the following commands:

Remove-SPSite –Identity http://sharepoint.com
get-spdeletedsite -webapplication http://sharepoint | Remove-SPDeletedSite
remove-spdeletedsite a56372bd-c6cc-4389-a8cb-089e0cddf7e3 -confirm:$false

But, keep in mind that the Gradual Delete Job would not delete the site right away, even you query the deleted site list with  "get-spdeletedsite" command, you ll see nothing, it doesn t mean that they are removed.

I think the Gradual Delete Job works once in a day or sth like that, so you should start the job manually.

Since I have done this job at the end of the day, in the morning everything was just fine.

I ll share if I can find how to trigger the job manually, I think it is in Central Admin - Monitoring..

Cheers


Source:

http://sharepoint.stackexchange.com/questions/31048/restore-spsite-reports-no-content-databases-are-available-for-this-operation
http://reality-tech.com/2012/04/04/gradual-site-collection-deletion/

23 Mart 2012 Cuma

CRUD operations on SP list items

Small code piece to for CRUD operations of sharepoint list items


using (SPSite site = new SPSite("http://website url/" ))
// Or SPContext.Current.Site.Url
{
using (SPWeb Web = site.OpenWeb())
  {
            Web.AllowUnsafeUpdates = true;

            // Open List
             SPList list = Web.Lists["MyList"];

            // Add new item in List
             SPListItem item = list.Items.Add();
             item["Title"] = "Test Title";
             item["Description"] = "Test Description";
             item.Update();

            // Get Item ID
             listItemId = item.ID;

            // Update the List item by ID
             SPListItem item = list.GetItemById(listItemId);
             item["Description"] = "Update Description";
             item.Update();

            // Delete item
             SPListItem item = list.GetItemById(listItemId);
             item.Delete();

            Web.AllowUnsafeUpdates = false;
       }
 }

source: