Pages

Showing posts with label Sharepoint 2010. Show all posts
Showing posts with label Sharepoint 2010. Show all posts

Thursday, March 21, 2013

Running SharePoint 2010 vhd in Windows 7 using Oracle Virtual Box.

Hi All

Here are the steps regarding how to run the 2010 VHD on Windows 7 box by using Oracle Virtual Box.

First we need to download and install below 3 softwares.

1>  Configure BIOS for HAV PCs.
http://www.microsoft.com/windows/virtual-pc/support/configure-bios.aspx

2> Download Oracle Virtual Box.
http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html

3>  Download SharePoint 2010 VVHD.
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27417

4> Place all files in a folder and extract the application file which will create a single vhd.
 
Let us see the below steps how to run the SharePoint 2010 VHD by using the Oracle VM Virtual Box. 
  1. Open Virtual Box and click "NEW" - which brings you one wizard to select for VHD. 
  2. Choose Operation System as "Microsoft Windows" and version as "Windows 2008 (64bit)click, "Next."
  3. In Memory dialogue box type 4096 MB(Recommended) or more and click, Next. Make sure your client system has more than 4GB RAM.
  4. Choose "Use existing hard disk" and navigate to  2010-7a.vhd clicking the icon.Next  and click, Finish.
  5. Click on "Storage" in the detail section. Click, 2010.7a.vhd and delete it using delete icon .     
  6. Click "SATA Controller" and delete it using delete icon.
  7. Under IDE Controller click add vhd icon.
  8. In dialogue box, click "choose existing disk.
  9. "Navigate to the 2010-7a.vhd and click ok.
  10. Under "System" allow process to use 2 CPUs instead of default 1.
  11. Start the virtual machine.
 Enjoy!
 Disha Shah

Thursday, February 28, 2013

Difference between DELETED and CLOSED SharePoint Webparts

Hello Friends

Recently I had an experience about the “DELETED” and “CLOSED” webparts on SharePoint Page and thought to share the same.

When we click the “x” button on webpart while editing page – it stands for closing webpart not deleting webpart. Closed webpart still stays on page and mutely consumes server resources every time when page is accessed.

Deleted webparts does not stay on page and if we do not need webpart we must delete webpart by clicking “Delete” on webpart while editing page.

Let us say user has “Closed “webpart by understanding that it has been deleted but in reality it is not so if we want to delete the “Closed” webpart, how could we do? For that we need to go to the Web Part Maintenance Page.

How do we get “WebPart Maintenance” Page? Very simple

Simply adds a given URL with the parameter: contents=1.

For example: http://sharepointdev/sites/test/default.aspx will become:
http://sharepointdev/sites/test/default.aspx?contents=1

Note:
If a web part is closed on a page (Open on page? = no), then using the "Reset" action will not restore the web part to the page. Rather, it will "reset" the web part to its default values. You need to use the steps described above to re-open the web part.
If we want to reopen the close webpart , follow below steps
  1. Site Actions > Edit Page: Add a web part
  2. Advanced Web part
  3. gallery and options
  4. Select "Closed Web Parts"
  5. Drag-n-drop the web part back onto your page
Enjoy!
Disha Shah

Thursday, November 15, 2012

Add Sections and Color to Surveys

Hi All
SharePoint provides rich functionalities via different types of SharePoint Lists and “Survey” is one of them. Let us see what is Survey?
  • SharePoint Survey is a kind of list when we want to poll other web site users on some topics.
  • Surveys features
    • Quickly create questions
    • Define how users their answers
When we need to use SharePoint Survey?
We could use the SharePoint Survey when an organization wants to collect the responses from various people about any event/ activity or on an any idea, we could use SharePoint Survey!
Users love the functionality provided by Survey inside SharePoint but they are frustrated when face its limitation like how to create sections and put their related section questions together (Bundle them) inside the Survey List

So below step-by-step solution will provide you to create questions and section formatting too.

Steps:

  1. Create the Section:
    1. Create a “Single line of text” question , give its default value as “SECTION” before you add any question for that section

  1. Go to your survey and click “Respond to this Survey” to display the Newform.aspx page
     
  2. Edit the URL to allow access to the web parts:
      append this to the end of the URL for the NewForm.aspx URL:  
                &ToolPaneView=2 
    and press Enter  
    http://yourserver/sites/yoursite/Lists/SurveyTest/NewForm.aspx?Source=.......overview.aspx&ToolPaneView=2
  3. Click “Add a Web Part” and add a Content Editor Web Part
     
  4. Move the Content Editor Web Part below the list web part
     
  5. Edit the web part, click the Source Editor button and add the JavaScript from below
     
  6. Save your changes and go test the survey!
<script>
 // hide the input textbox for the "description" text
 var x = document.getElementsByTagName("INPUT");
 var i=0;
 for (i=0; i<x.length; i++)
 {
  if (x[i].value=="SECTION")
  {
    x[i].style.display="none";
  }
 }
</script>

Add color to your surveys!

Just follow the steps above, but use the following JavaScript. Manually embed your HTML in the text of the question: "Please take time to respond this survey about <b><i>Important Stuff</i></b>. "
<script>
 // Fix tags to allow HTML
 var t = document.getElementsByTagName('table');
 for (var i=0; i<t.length; i++)
 {
   if (t[i].className=='ms-formtable')
   {
     var td = t[i].getElementsByTagName('td');
     for (var j=0;j<td.length;j++)
     {
       if (td[j].innerHTML.indexOf('&lt;') > -1)
       {
         td[j].innerHTML = td[j].innerHTML.replace(/&lt;/g,'<').replace(/&gt;/g,'>');
       }
     }
   }
 }
</script>

Let us we want to add sections and color with HTML Style!
Use both JavaScript routines together:
<script>
 // hide the input textbox for the "description" text
 var x = document.getElementsByTagName("INPUT");
 var i=0;
 for (i=0; i<x.length; i++)
 {
  if (x[i].value=="SECTION")
  {
    x[i].style.display="none";
  }
 }

 // Fix tags to allow HTML
 var t = document.getElementsByTagName('table');
 for (var i=0; i<t.length; i++)
 {
   if (t[i].className=='ms-formtable')
   {
     var td = t[i].getElementsByTagName('td');
     for (var j=0;j<td.length;j++)
     {
       if (td[j].innerHTML.indexOf('&lt;') > -1)
       {
         td[j].innerHTML = td[j].innerHTML.replace(/&lt;/g,'<').replace(/&gt;/g,'>');
       }
     }
   }
 }
</script>

Loved SharePoint Customization Tricks!
Disha Shah

Friday, July 13, 2012

Print Functionality of List Vew Webpart in SharePoint

Hello Friends

User wants to print the available listitems of a list from a ListViewWebpart in a page and they want to print only those records rather than entire page content (Left Navigation, breadcrumbs etc.) .

So we could not provide the "print" functionality from the browser so we have to include below javascript inside the Content Editor Webpat and now you have print functionality available for ListView webpart only.

Add a content editor webpart on same page where your ListViewWebpart resides.
Write this javascript in the content editor webpart.

<input onclick="javascript:void(PrintWebPart())" type="button" value="Print Page"/> <!-- copy and paste in to a content editor source editor web part --><script language="JavaScript">



<!-- Web Part/region to print -->
var WebPartElementID = "MSO_ContentTable";

//Function to print Web Part
function PrintWebPart()
{
 var bolWebPartFound = false;
 if (document.getElementById != null)
 {
  //Create html to print in new window
  var PrintingHTML = '<HTML>\n<HEAD>\n';
  //Take data from Head Tag
  if (document.getElementsByTagName != null)
   {
   var HeadData= document.getElementsByTagName("HEAD");
   if (HeadData.length > 0)
    PrintingHTML += HeadData[0].innerHTML;
   }
  PrintingHTML += '\n</HEAD>\n<BODY>\n';
  var WebPartData = document.getElementById(WebPartElementID);
  if (WebPartData != null)
  {
   PrintingHTML += WebPartData.innerHTML;
   bolWebPartFound = true;
  }
  else
  {
   bolWebPartFound = false;
   alert ('Cannot Find Web Part');
  }
 }
 PrintingHTML += '\n</BODY>\n</HTML>';
 //Open new window to print
 if (bolWebPartFound)
 {
  var PrintingWindow = window.open("","PrintWebPart", "toolbar,width=800,height=600,scrollbars,resizable,menubar");
  PrintingWindow.document.open();
  PrintingWindow.document.write(PrintingHTML);
  // Open Print Window
  PrintingWindow.print();
 }
}</script>

Now you all set for print the listitems of listviewwebpart in SharePoint Pae.

Disha Shah

Thursday, July 5, 2012

Associate an SharePoint Designer workflow with a specific task list

Hello All,

If we would like to associate a different SharePoint Task List to SharePoint Designer workflow from more than available Task Lists, there is not any direct way or user interface to do this.

The configuration for which task List is configured to SharePoint Designer Workflow is stored  inside the wfconfig.xml file. This is not an recommended way to do this.

If there are multiple task list available inside SharePoint site, SharePoint Designer Workflow picks up the first Task List.

So if we want to attach Task List of our own choice , we need to follow these steps.

1> Create a task list which lists first as Task List.

2> In SharePoint Designer, create a new workflow and compile it (click Finish in the Workflow Designer)

3> Now rename that task list from SharePoint User Interface.

That's it!!!You are all set with the SharePoint Designer 2007 Workflow with your desired Task List.

Disha Shah

Wednesday, July 4, 2012

SharePoint PDF Files - Open in AdobeReader

Hello

Users found difficulty when they open any PDF files which are in Document Library, it always 
opens in browser and if they close it, it will close SharePoint Portal. If they would like to 
continue work inside the SharePoint Portal, they have to re-open SharePoint Portal.

So how to solve this? Please follow the below steps to change Adobe Reader settings to open 
PDF files.

1.       Click Start from your desktop
2.       Go to All Programs
3.       Open the Adobe Reader program:
4.       Select Preferences from Edit menu:
5.       From Internet from the Categories list and uncheck the Display PDF in browser option:
Once these setting are changed the PDF will no longer open in the browser window.  Problem Solved!!!


Disha Shah

Friday, March 30, 2012

Customize the Homepage of SharePoint Blog Sites for Blog Posts Webpart

Hello Friends

The purpose of today Blog is how we can customize view of Posts for Blog Site.
Actually I want to add the new fields on the homepage of the blog site template’s summary view web part for each of the posts.

Let us see how can we do this. Here is step by step process to do this

1. I assume that You have already created your blog site, Add custom column inside the Posts List , in my case it is DelegatedBy which is Person or Group field type.

2. I have downloaded this custom blog.xsl file and upload it to a Site Assets or any other Document Library of your choice. Search for “DelegatedBy” where we added this field to the output which is the only customization that was 
performed on the original XSL.

3. Open the blog site homepage and edit it in SharePoint Designer. Here, you’ll want to click on the Posts web part and add the DelegatedBy column for the field to be displayed in the view.



4. We need to include a link reference to the custom XSL that you had uploaded in Step 2.



5. Save changes that you’ve made in SharePoint Designer and browse to your blog site , magic will happen .

Enjoy Blog Site!!!

Thanks
Disha Shah


Wednesday, March 14, 2012

Apply CSS for SPGridView Programatically in Webpart

Hello Friends

I have been working on webpart in which I was using SPGridView. Now I want to apply  fore-color to one column inside the SPGridView. When I tried with everything and none of them was working , every time it gets color from CSS file then I tried below line it works like magic!!!

oGridColCourse.ItemStyle.CssClass = "color: #0000F5 !important;";

Happy Coding!!!
Disha Shah

Tuesday, March 6, 2012

Move/Migrate SharePoint List Attachments to Document Library with Created and Modified Date

Hello

We have faced one problem about SharePoint Search . We have SharePoint list in which we have items and it has attachments, but SharePoint Search could not look inside Documents which are stored as Attachments in List. So to make it work we have to move all attachments inside the document library so SharePoint Search can crawl and return the results :).

So to provide Keyword Search we need to Move the SharePoint Attachments to Document Library so that we can search in SharePoint Search.

Here is code which will move SharePoint List Attachments to Document Library.

SPSecurity.RunWithElevatedPrivileges(delegate()
           {
               using (SPSite site = new SPSite("SiteURL"))
               {
                   SPList docDestination = site.RootWeb.Lists["DocName"];
                   SPFolder fldRoot = site.RootWeb.Folders[docDestination.Title];
                   SPFileCollection flColl = null;
                   SPList lstAttachment = site.RootWeb.Lists["ListName"];
                   foreach (SPListItem lstItem in lstAttachment.Items)
                   {
                       if (lstItem.Attachments != null && lstItem.Attachments.Count > 0)
                       {
                           foreach (String strName in lstItem.Attachments)
                           {
                               flColl = fldRoot.Files;
                               SPListItem listtem = docDestination.Items.Add();
                               SPFile FileCopy = lstItem.ParentList.ParentWeb.GetFile(lstItem.Attachments.UrlPrefix + strName);

                               string destFile = flColl.Folder.Url + "/" + FileCopy.Name;
                               byte[] fileData = FileCopy.OpenBinary();

                               SPFile flAdded = flColl.Add(destFile, fileData, site.RootWeb.CurrentUser, site.RootWeb.CurrentUser, Convert.ToDateTime(lstItem[SPBuiltInFieldId.Created]), Convert.ToDateTime(lstItem[SPBuiltInFieldId.Modified]));
                               SPListItem item = flAdded.Item;
                               item[SPBuiltInFieldId.Created] = Convert.ToDateTime(lstItem[SPBuiltInFieldId.Created]);
                               item[SPBuiltInFieldId.Modified] = Convert.ToDateTime(lstItem[SPBuiltInFieldId.Modified]);
                               flAdded.Item.Update();
                           }

                       }
                   }
               }
           });

Disha Shah

How to Copy ListItem from One List to Another List

Hello

Here is code how to copy ListItem from one list to another list from eventhandler.
Make sure both list has same List Field Structure.

Here is Code

public override void ItemAdded(SPItemEventProperties properties)
       {

           if (properties.List.Title.Equals("ListA"))
           {
               SPListItem CopyItem = properties.Web.Lists["ListB"].Items.Add();

               foreach (SPField f in properties.ListItem.Fields)
               {
                   //Copy all except attachments.
                   if (!f.ReadOnlyField && f.InternalName != "Attachments"
                       && null != properties.ListItem[f.InternalName])
                   {
                       CopyItem[f.InternalName] = properties.ListItem[f.InternalName];
                   }
               }


               foreach (string fileName in properties.ListItem.Attachments)
               {
                   SPFile file = properties.ListItem.ParentList.ParentWeb.GetFile(properties.ListItem.Attachments.UrlPrefix + fileName);
                   byte[] imageData = file.OpenBinary();
                   CopyItem.Attachments.Add(fileName, imageData);
               }
               CopyItem.Update();

           }
       }

Hope it helps!!!

Disha Shah

Thursday, March 1, 2012

How to get username from JQuery

Hello Friends


Use below Jquery to get the Current User name
var thisUserAccount = $().SPServices.SPGetCurrentUser({
                fieldName: "Title",
                debug: false
});

Use below code to get the ID for Current User
var thisUserAccount = $().SPServices.SPGetCurrentUser({
                fieldName: "ID",
                debug: false
});

Use below code to get the LoginName for Current User
var thisUserAccount = $().SPServices.SPGetCurrentUser({
                fieldName: "Name",
                debug: false
});

Disha Shah

jQuery is undefined in IE / spservices is null or not an object in IE

I just hated this error when I was working with JQuery. It is working perfectly OK with other browsers but in IE it just makes me crazy.

Then I figured out problem and that was the referencing of files.

I was using  jquery-1.6.1.min.js file from Internet and this file jquery.SPServices-0.6.2.min.js from document library.

Actually the problem with those files were I was referring jquery-1.6.1.min.js from Web and jquery.SPServices-0.6.2.min.js  from document Library and then I downloaded the jquery-1.6.1.min.js file and uploaded to document library where I have put the other file. Then it works like charm.

Disha Shah