Hi all. If you have error on site collection when started your site, you can check password account pool site.

1. Verify the username and password in the Central Administration App Pool (right click->Properties->Identity[tab])
2. Verify that any services that are running relating to IIS or WSS/MOSS are using valid usernames and passwords.
3. Verify that any services running for SQL Server are using the right username and password.
4. Verify that the account in question has the proper access to the sharePoint databases

Advertisements

Hi all. Today I should talk about automatic rename file name on document library in Sharepoint 2010. Sample, I have one document library and include more folders with documents inside. I can create event receiver for automatic update name file on folders in library.

I’m used class SPFile and method GetFile() for gets properties created file.

SPFile – Represents a file in a SharePoint Web site that can be a Web Part Page, an item in a document library, or a file in a folder.

This sample automatic update file name in folders document library Sharepoint 2010.

public class EventReceiver1 : SPItemEventReceiver
    {
       /// <summary>
       /// An item was added.
       /// </summary>
       public override void ItemAdded(SPItemEventProperties properties)
       {
           base.ItemAdded(properties);

           SPFile file = properties.Web.GetFile(properties.ListItem.Url);
           if (file.Item.ContentType.Name == "Document")
           {
               file.Item["Name"] = properties.AfterUrl.Replace("/", "-");
               file.Item.Update();
           }
       }

}

Next sample I can automatic update file name, when I updated name folder on my library documents.

I been used class SPFileCollection and method GetFolder for gets properties updated folder on Sharepoint 2010.

SPFileCollection – Represents a collection of SPFile objects.

Use the Files property of either the SPWeb or SPFolder class to return the collection of files for the site or folder. To create a new file, use one of the Add methods of SPFileCollection.

Use an indexer to return a single file from the collection. For example, assuming the collection is assigned to a variable named collFiles, use collFiles[index] in C#, or collFiles(index) in Visual Basic, where index is either the index number of the file in the collection or the display name of the file

This sample automatic update file name, when updated name folder document library Sharepoint 2010.

       /// <summary>
      /// An item was updated
      /// </summary>
      public override void ItemUpdated(SPItemEventProperties properties)
      {
          base.ItemUpdated(properties);

          SPFile file = properties.Web.GetFile(properties.ListItem.Url);
          if (file.Item.ContentType.Name == "Folder")
          {

              SPFileCollection fileCollection = properties.Web.GetFolder(properties.ListItem.Url).Files;

              foreach (SPFile fileItem in fileCollection)
              {
                  fileItem.Item["Name"] = fileItem.Item.Name + properties.AfterUrl.Replace("/", "-");
                  file.Item.Update();
              }
          }

      }

That’s all. If you can automatic update name folder on library Sharepoint 2010, else you can write this code:

SPFolder.Name = "NewFolderName";

SPFolder.MoveTo("brandspakningnewSPFolder.Name");

TechEd 2010 online

November 12, 2010

Hi all. You may see all video with TechEd 2010 Europe – http://www.msteched.com/

Microsoft Tech·Ed Online

You can see – http://www.techdays.in.ua/videos/3005.html

Today 04/11/2010 at 04-00 PM. Click this link – http://it-club.in.ua/Lists/Calendar/DispForm.aspx?ID=70