Pages

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

Monday, March 21, 2016

Migrating a custom list with attachments from SharePoint 2007 to SharePoint 2013

There is a workaround I found and used to migrate a custom list with attachments from SharePoint 2007 to SharePoint 2013.

Below are steps:
1. Use Access 2010 to import the SharePoint 2007 list into a database
2. From Access 2010 export to the SharePoint 2013 site

When I first exported it, it was read-only (That was issue). So, I had to do it again (import then export) but make sure the database in access was not read only. It worked very well after that. I got all attachments. 

Friday, May 3, 2013

Completed Salem™ Certified Practitioner Online Course

Hi All

Yay, I’m very happy as I've successfully completed Genius SharePoint Business Strategist course http://thesharepointstrategist.com/about-us/ which qualified me as certified Salem™ Practitioner.

Salem™ is framework which can be used in any business for SharePoint as a solution.

Salem™ (Sequenced and Logical Enterprise Methodology) – course contains 15 different modules which are connected and are very useful to applied to any business : http://geniuscourses.litmos.com/online-courses/register/25684

Here are some of features of this online course:
·         Available online – which is very flexible for anyone.
·         Course materials are so much in detail and concise for each sections which are understandable
·         Videos and slides are nice explained with real life example
·         Length of this course is suitable
After completing this course you must know how business should use SharePoint and what parameters needs to be considered when it comes to apply SharePoint in real life!

I enjoyed this course and recommend taking the same course to improve SharePoint knowledge!

Disha Shah

Thursday, March 21, 2013

Get and set BDC Column Value via Javascript

Hi All

We already know very well reagarding "getTagFromIdentifierAndTitle" function in SharePoint which is very useful to set and get the value of TextBox, DataField, Dropdown and many more to set and get the values from control. But what about if your list contains BDC Column value. How to set  and get the value from BDC Column?

Here is the jascript to achieve set and get the BDC column Value.

<script type='text/javascript'>
//set default value
_spBodyOnLoadFunctionNames.push("loadandhideBDC");
function loadandhideBDC()
{
setDefault();
}

//To check it contains value before saving
 function PreSaveAction() {
var elem = getBDCTagFromIdentifierAndTitle("TEXTAREA","Object Picker", 1);
if(elem.value =="")
{
 alert( "Invalid Value");
 return false;
}
}

function getBDCTagFromIdentifierAndTitle(tagName, title, count) {
var tags = document.getElementsByTagName(tagName);
var myCount = 0;
for (var i=0; i < tags.length; i++) {
var tempString = tags[i].id;
if (tags[i].title == title){
myCount++;
if(count == myCount){
return tags[i];
}
}
}
return null;
}


function setDefault() {
var variety = "";
var elem = getBDCTagFromIdentifierAndTitle("TEXTAREA","Object Picker", 1);
if(elem) elem.value = variety;
var elem = getBDCTagFromIdentifierAndTitle("DIV","Object Picker", 1);
if(elem) elem.innerText = variety;
}
</script>

Disha Shah

Jquery Redirect After save an item from NewForm.aspx and EditForm.aspx

Hello all

I came across to an situation where user needs to redirect to a "Thank You" or lets say different page when they save item fron "NewForm.aspx" or "EditForm.aspx".

As I do not want to use Visual Studio code that ater save item Event Receiver - "ItemAdded" I tried to look around is there any other option available like Jquery , and yes we can , so easy :)

Here is the code for that.

$(document).ready(function() {

        var button = $("input[id$=SaveItem]"); 
// change redirection behavior 
button.removeAttr("onclick"); 
 button.click(function() { 
             var elementName = $(this).attr("name"); 
             var aspForm = $("form[name=aspnetForm]"); 
             var oldPostbackUrl = aspForm.get(0).action; 
             var currentSourceValue = GetUrlKeyValue("Source", true, oldPostbackUrl); 
             var newPostbackUrl = oldPostbackUrl.replace(currentSourceValue, "custompageurl.aspx"); 
   
             if (!PreSaveItem()) return false; 
             WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(elementName, "", true, "", newPostbackUrl, false, true)); 
         }); 
});

Enjoy Jquery!
Disha Shah

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

Wednesday, August 15, 2012

SharePoint 2007 Workflow Fail to Start(retrying) in Designer and Out-of-Box

Today I ran into one workflow error, "Fail to Start(retrying)". As usual not detail description is available which has frustrated me.

After looking here and around, I found that the Service Account which is used by my web-application is different from IIS identity account to SharePoint Central Administration.

Here are the steps to solve it.
 
Steps:

1. Open SharePoint Central administration -> Go to Operations.

2. Under Security configuration sections, go to service accounts.

3. On the service account screen in web application pool dropdown,select windows sharepoint services web application and in appplication pool drop down select the web application where the workflow is not working.

4. Now, Check the apppool account in configurable. This account should match the identity account for your web application in IIS. If it is not ; make it the same and everything goes works fine.


Hope this helps!!
Disha Shah

Monday, July 23, 2012

Sharepoint 2013 and presentations


Hello All

Wow, what a great news, Microsoft released SharePoint 2013 beta!!!!

To get started with it , Sharepoint 2013 presentations were released by Microsoft and can be downloaded at

http://www.microsoft.com/en-us/download/details.aspx?id=30361

So exicted !!!!

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