Tuesday 28 October 2014

Delete all attachments from custom SharePoint list without code

There are some times when you asked to delete all attachments from a SharePoint list. SharePoint itself has given simple solution for this which will not require knowledge about coding or PowerShell or any difficult and time consuming techniques.

Few clicks and your work is done.

  1. Open your list
  2. Go to list settings
  3. Advanced Settings
  4. In Attachments option select radio button "Disabled" and click OK
  5. It will ask you for confirmation
  6. And once you confirmed, it will delete all attachments from SharePoint list
Done....

Hope this helps...


Tuesday 2 September 2014

Adding user in SharePoint group programmatically

Below is the code to add user in SharePoint group programmatically:


 using (SPSite site = new SPSite(Respective Site URL))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    try
                    {
                        SPUser requiredUser = web.EnsureUser("domainname\\username");

                        if (requiredUser != null)
                        {
                            SPGroup requiredGroup = web.Groups["groupName"];
                            if (requiredGroup != null)
                                requiredGroup.AddUser(requiredUser);
                        }
                   
                    }
                    catch (Exception ex)
                    {
                     
                    }                 
                }
            }

Monday 1 September 2014

Error occurred in deployment step 'Retract Solution': Object reference not set to an instance of an object.

Today while deploying a custom solution on our development server using Visual Studio 2012, I received below error in Visual Studio: 
"Error occurred in deployment step 'Retract Solution': Object reference not set to an instance of an object."

This was working well till day before and suddenly it started to throw same error again and again.
Then I went to retract same solution through Central Administration, and it shown me actual error that was happening.

The SharePoint_Config log file got full. After shrinking the log file, solution got deployed without any error.

Thursday 21 August 2014

How to check which edition of SharePoint is running on server?

You can check the SharePoint Edition by going into Central Administration.

In Central Administration go to Upgrade and Migration --> Convert farm license type.
It will show you current edition. For e.g. SharePoint Server with Enterprise Client Access License.

Hope this helps.!!!!!


Tuesday 3 June 2014

SharePoint: This entry cannot be validated. Exception Object reference not set to an instance of object. occurred

Today while using Audience settings in navigation , I got the error while validating groups in Audience setting, even groups are correctly set.

The following error message was appearing during audience validation:
 This entry cannot be validated. Exception Object reference not set to an instance of object. occurred

After some quick search on internet i found that, there might be possibility of User Profile Service is not associated with web application.

To check that, I went to Central Administration --> Application Management --> Manage Web application.
Selected my web application and clicked on "Services Connection"

The check-box in front of User Profile Service Application was unchecked. I selected the check-box and clicked OK.

Then I went to set the audience and problem was resolved.

Cheers!!!!!!. Hope this helps.



Related Posts Plugin for WordPress, Blogger...