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

Wednesday, May 30, 2012

Open the Edit Form of External List from BCS Profile Page

Recently I had a business scenario, where the user wanted to use a Business data in not traditional way:

  • To find a particular entity instance with not using of search – the external system contains 20+ millions of entries, the crawl time (full and incremental) will be significant and have to be processed daily
  • To edit an entity instance with no browsing of External List – there is no way to find the particular item in the EL

Finally I designed the following solution:

  • Developed a BCS .net assembly connector in Visual Studio, which connects to Oracle database. It contains a few entities, but for simplicity we will focus on only one – Customer. It has three operations – Finder, Specific Finder and Updater and identifier UNID (string)
  • After deployment on my SPS 2010 I created a profile page in the standard way, through BDC service application’s management page in CA
  • Meanwhile I created a small configurable web part which accepts two parameters (text boxes) Customer_ID and Date (because of the business users), executes a SQL query against the Oracle and returns the UNID of the only record. The web part redirects the user to the profile page, created in the previous step. Actually this small component plays as an “item picker” which opens the item’s profile page!
  • Additionally I created an external list with view and edit forms

So, the biggest question was HOW once landed on the profile page the user can jump directly to the Edit form ??? Where is the problem? The edit form expects a parameter BcsIdentity instead of UNID and there is not a normal way to get it.

  • I added a BCS action (not external list custom action) from BDC service application’s management page in CA. Named it “EDIT” and the URL was the URL of my EditForm.aspx http://myportal/List/MyExternalList/EditForm.aspx?UNID={0}, where UNID is the identifier of my entity
  • The action is visible/accessible from the profile page. Clicking on it the user jumps to EditForm.aspx, but with wrong parameter ?UNID=123456, instead of ?ID=<BcsIdentity> and the form is empty
  • I developed a second web part, which reads the UNID parameter from the query string and encodes it in “a BCS way”

SmileSmileSmile

string unid = qstr["UNID"];
object[] identifiers = { unid };
string identifiersEnc = EntityInstanceIdEncoder.EncodeEntityInstanceId(identifiers);
string newUrl = string.Format("{0}&{1}={2}&source={3}", Page.Request.Url.ToString(),newQstrParamName, identifiersEnc, SPContext.Current.Site.Url);
Page.Response.Redirect(newUrl, true);

Finally the code redirects the browser to the same page (EditForm.aspx) but with newly added parameter ID=”myEncodedIdentifier” and the Edit form work as expected!

Special thanks to Pradeep Kamalakumar, for his significant help!

Tuesday, October 11, 2011

Ribbon Customizations and CustomActions in SharePoint 2010

In the beginning of October 2011 we did the second off-site meeting with our User Groups in Bansko (Bulgaria). Below are the slides and demo code from my presentation.


I covered the development of customizations, for SharePoint 2010 user interface, meaning custom actions, ribbon elements, notifications, statuses and dialog framework.




You could download the full Visual Studio project from here:http://db.tt/eZncKy2E


It contains an extra code for playing with bulk selection, ribbon button and modal dialog. Feel free to use it Smile


Simple ribbon button


                <!-- Simple button -->
<
CommandUIDefinition Location="Ribbon.Library.Share.Controls._children">
<
Button Id="Ribbon.Library.Share.SugbgButton"
Command="SugbgButtonCommand"
Image32by32="/_layouts/images/PPEOPLE.GIF"
LabelText="Hello SUGBG"
TemplateAlias="o1" />
</
CommandUIDefinition>


Tooltip ribbon button


                <!-- ToolTip button -->
<
CommandUIDefinition Location="Ribbon.Documents.New.Controls._children">
<
Button Id="Ribbon.Documents.New.Ribbontest"
Alt ="Test Button"
Sequence="5"
Command="RibbonTestCommand"
LabelText="Test Button"
Image32by32="/_layouts/images/QuickTagILikeIt_32.png"
TemplateAlias="o1"
ToolTipTitle="My test button tool tip"
ToolTipDescription="My tool tip description"
ToolTipShortcutKey="Ctrl-T,E"
ToolTipImage32by32="/_layouts/images/mwac_infob.gif"
ToolTipHelpKeyWord="WSSEndUser"/>
</
CommandUIDefinition>


Replace an existing ribbon button (New Folder)


                <!-- Replace a button -->
<
CommandUIDefinition Location="Ribbon.Documents.New.NewFolder" >
<
Button Id="Ribbon.Documents.New.NewFolder.MyNewFolderButton"
Alt ="Test button"
Sequence="5"
Command="MyNewFolderButtonCommand"
LabelText="New Folder"
Image32by32="/_layouts/images/menureply.gif"
TemplateAlias="o1" />
</
CommandUIDefinition>


Add ribbon button to edit form


                <!--Add a button to the edit form-->
<
CommandUIDefinition Location="Ribbon.DocLibListForm.Edit.Actions.Controls._children" >
<
Button Id="Ribbon.DocLibListForm.Edit.Actions.MySettings"
Command="EditFormButtonCommand"
Description="Go to settings"
LabelText="Site Settings"
Image32by32="_layouts/images/settingsIcon.png"
TemplateAlias="o2"
Sequence="91"/>
</
CommandUIDefinition>


All elements above are using the these handlers:



            <CommandUIHandlers>
<
CommandUIHandler Command="SugbgButtonCommand"
CommandAction="javascript:HelloRibbon();" />


<
CommandUIHandler Command="RibbonTestCommand"
CommandAction="javascript:alert('RIBBON-test was clicked');" />


<
CommandUIHandler Command="MyNewFolderButtonCommand"
CommandAction="javascript:alert('I replaced the OOB New Folder :)');" />


<
CommandUIHandler Command="EditFormButtonCommand"
CommandAction="/_layouts/settings.aspx" />
</
CommandUIHandlers>


HelloRibbon() function and related javascriptcode also could be deployed with CustomAction



    <CustomAction Id="Ribbon.Library.Actions.NewButton.Script"
Location="ScriptLink"
ScriptBlock="
function HelloRibbon()
{
alert('Hello, Ribbon Script is here!');
}
" />


Very powerful Visual Studio add-in for quick start with ribbon customizations are SharePoint 2010 Extensibility Projects and especially SharePoint Ribbon VSIX



 



Other CustomActions



    <!-- Custom Action Group in Site Settings page -->
<
CustomActionGroup
Id="MyActionGroup"
Description="This group contains all my custom actions."
Title="My Action Group"
Location="Microsoft.SharePoint.SiteSettings"
Sequence="30"
ImageUrl="/_layouts/images/mwac_textpb.gif"/>

<!--
Custom Action in Custom Action Group in Site Settings page -->
<
CustomAction
Id="MyCustomAction"
Description="This link is a custom action."
Title="My Custom Action"
GroupId="MyActionGroup"
Location="Microsoft.SharePoint.SiteSettings"
Rights="ManageWeb"
RequireSiteAdministrator="FALSE"
Sequence="20">
<
UrlAction Url="~sitecollection/_layouts/create.aspx" />
</
CustomAction>

<!--
Custom Action in Site Actions Menu -->
<
CustomAction
Id="MyNewCustomAction"
Description="This menu item is a new custom action."
Title="My New Custom Action"
GroupId="SiteActions"
Location="Microsoft.SharePoint.StandardMenu"
ImageUrl="/_layouts/images/mwac_thumbb.gif"
Sequence="10">
<
UrlAction Url="~sitecollection/_layouts/settings.aspx" />
</
CustomAction>

<!--
Adding Custom action for items in Document Library-->
<
CustomAction Id="ListMenuForMyPage"
RegistrationType="List"
RegistrationId="101"
ImageUrl="/_layouts/images/GORTL.GIF"
Location="EditControlBlock"
Sequence="105"
Title="My Page" >
<
UrlAction Url="DispForm.aspx?ItemId={ItemId}&amp;ListId={ListId}" />
</
CustomAction>


Playing with Dialogs – below is the client code which shows dialogs, using Sharepoint 2010dialog framework



<a href="javascript:showMyDialog();" id="ShaowMydialogID" style="display:inline;">
Show MyDialog
</a>


<!--Define dialog inline-->

<div id="SugbgDiv" style="display:none; padding:5px">

    <
input type="text" value="SUGBG dialog" />

    <
input type="button" value="OK" onclick="closeDialog()" />

</
div>







<!--Load Sharepoint ScriptLink-->

<SharePoint:ScriptLink ID="SPScript" runat="server" Localizable="false" LoadAfterUI="true" />







<!--Open Dialogs-->

<script language="ecmascript" type="text/ecmascript">




    var
myDialog;


    var sid;





    function showMyDialog() {


        var MyDialogDiv = document.getElementById("SugbgDiv"); MyDialogDiv.style.display = "block";





        var options = { html: MyDialogDiv, width: 200, height: 200 };


        myDialog = SP.UI.ModalDialog.showModalDialog(options);





    }





    function closeDialog() {


        myDialog.close();








</script>


You could show everything in the modal window, see how to use it to show en ExcelServices chart as image, using REST



<a href="javascript:ExcelChart();" id="ExcelChartID" style="display:inline;">
Excel MyDialog
</a>




<script language="ecmascript" type="text/ecmascript">



function ExcelChart() {
var options = { url: 'http://intranet/_vti_bin/ExcelRest.aspx/Shared%20Documents/Gears%20Sales%20History.xlsx/model/Charts(\'Chart 1\')?$format=image', width: 400, height: 400 };
myDialog = SP.UI.ModalDialog.showModalDialog(options);
}


</script>



Playing with StatusBar



<script language="ecmascript" type="text/ecmascript">



var sid;



//Status bar

function createStatusBar() {
sid = SP.UI.Status.addStatus("My status bar title", "My status bar <a href=\"#\">message<\a>", true);
}

function removeStatusBar() {
SP.UI.Status.removeStatus(sid);
}

function removeAllStatusBars() {
SP.UI.Status.removeAllStatus(true);
}

function updateStatusBar() {
SP.UI.Status.updateStatus(sid,"This is a status update");
}

function appendStatusBar() {
SP.UI.Status.appendStatus(sid,"This is appended", "This is my appended <i>status</i>");
}

function redStatusBar() {
SP.UI.Status.setStatusPriColor(sid, "red");
}

function greenStatusBar() {
SP.UI.Status.setStatusPriColor(sid, "green");
}

function blueStatusBar() {
SP.UI.Status.setStatusPriColor(sid, "blue");
}

function yellowStatusBar() {
SP.UI.Status.setStatusPriColor(sid, "yellow");
}


</script>



Notifications



<script language="ecmascript" type="text/ecmascript">



//Notifications
var notificationId;

function showNotification() {
notificationId = SP.UI.Notify.addNotification("The party has to begin after 6 hours! :)");
}

function removeNotification() {
SP.UI.Notify.removeNotification(notificationId);
}



</script>



Find the download link above to get the full VS project. Enjoy!

Tuesday, June 7, 2011

Custom web service for SharePoint

I will just publish my project online, without long explanations:

  • Target – SharePoint 2010
  • Visual Studio 2010
  • What is included:
    • Feature which is deploying demo data
    • Custom web service (asmx)
    • Class library (DLL)
    • Web Service consumer (console app)

You could get the code from here!

Enjoy

Smile

Saturday, April 2, 2011

SharePoint 2010-Architecture Planning from the Field

Here is my presentation from Microsoft Days 2011 (30-31 March 2011, Sofia, Bulgaria)

SharePoint 2010: Architecture Planning from the Field

and a direct link

Enjoy!

Friday, March 25, 2011

SharePoint Sessions in MS Days 2011

Next week (30-31.03.2011) we’ll open the 10th issue of Microsoft Days in Bulgaria. There is a dedicated SharePoint track during the second day, with the following sessions:

Time slot Session Speaker Hall
9:15 – 10:15 SharePoint 2010: Practical Architecture Planning from the Field Tihomir Ignatov Hall 5
10:45 – 11:45 SharePoint 2010: Authentication and Authorization Smackdown Radi Atanassov Hall 5
12:45 – 13:45 The Search Story at SharePoint 2010 Tihomir Ignatov Hall 5
14:15 – 15:15 Connecting Two Clouds – Sharepoint Online in Office 365 and Windows Azure Damien Caro Hall 5
14:15 – 15:15 Case Study: Там където SharePoint, BI & Silverlight се срещаха с бизнеса! Rossen Zhivkov VIP Hall
15:45 – 16:45 Schema-Based Development with SharePoint 2010 Radi Atanassov Hall 5
15:45 - 16:45 SharePoint in the Cloud – Developing Solutions for SharePoint Online Branimir Gyurov Hall 7

Other SharePoint and Cloud related sessions in the first day:

  • Microsoft Office 365 – What does it means for IT Pros?
  • Case Study: Buildning a Centralized Knowledge Management system on the top of SharePoint 2010
  • Social Networking in the Enterprise: Delivering Facebook-like experience with SharePoint 2010 & Going Mobile

Enjoy!

Thursday, January 27, 2011

Sharepoint 2010 Automated Deployment

I tested http://autospinstaller.codeplex.com/ for the needs of my projects and it is very useful tool. Well developed PowerShell application with configuration options. You only need to attach the SPS 2010 media (iso) and start the script.

Smile

Wednesday, January 5, 2011

Sharepoint 2010: Fixing the Flyout Delay

When rolling over a number of flyouts quickly, the user sees all the flyouts shown on the screen at once which looks rubbish. 

To remove the delay altogether use this css in your page somewhere:

li.hover-off>ul

{ display:none; }

Friday, December 24, 2010

Sharepoint 2010 Capacity Planning and Sizing Tool

In the last few months I had a few projects where I had to plan the capacity of SharePoint Server 2010 farms. There are some very useful resources in Technet:
Capacity management and sizing for SharePoint Server 2010
http://technet.microsoft.com/en-us/library/cc261700(office.14).aspx
Storage and SQL Server capacity planning and configuration (SharePoint Server 2010)
http://technet.microsoft.com/en-us/library/cc298801(office.14).aspx
Actually the second article was my starting point for this blog post. The question was – how to size the storage for Sharepoint Server 2010 HA environment? I created an Excel sheet which implemented all rules and advises, mentioned in the resources above. You could download and use it for your projects and of course feel free to customize it. I’ll be very thankful if someone decide to contribute and extend the existing content!

Open it directly from SkyDrive: Sharepoint 2010 capacity planning and sizing sheet

Tool Reference
The idea behind this tool is that for each Sharepoint Server 2010 deployment stays a particular business need. Almost always we have a content, which has to be uploaded after deployment and this is our initial data. This data always grows and our sizing and capacity planning approach has to cover this important factor.
General Sites Sizing Sheet
image
Enter in this section your initial files count and volume in GB
image
Decide how many initial sites you will have in the farm (one row for each) and divide your initial files between them – as count and as volume.
image
Define a growth model for each site collection for the next 1 year using the tables. The final size (colored cell) will be auto populated in the above table.
You could find a detailed description of the used formula in Technet
http://technet.microsoft.com/en-us/library/cc298801.aspx
image
Cell B26 formula: =(B19*B21*B23)+(10*(B22+(B23*B19)))
You can always see the formula details for particular cell from Ribbon/Formulas tab/Formula Auditing group (Excel 2010)
image
Capacity Sheet
Use the screen shots below, Formula Auditing tools and Formulas in the Excel file to understand the logic of the calculations.
image
image
image
image
image
image

Saturday, November 27, 2010

SUGBG and Telerik

On 24 November we did a SUGBG meeting together with Telerik, They presented the integration of their AJAX, Silverlight and Reporting with Sharepoint 2010. It was a great session with a lot of questions, discussions and feedback. Thanks guys!

Follow us up in Facebook

Saturday, October 23, 2010

Troubleshooting User Profile Service

Wow, it it amazing troubleshooting experience. Did you get your User Profile Service (Sharepoint 2010) working without issues?

if (upsWorking)

{Console.WriteLine(“You are lucky man”);}

Smile

So, some useful resources, thanks to Stefan for share!

Probably the best guides are here (thanks to Spence)

Rational Guide to implementing SharePoint Server 2010 User Profile Synchronization
“Stuck on Starting”: Common Issues with SharePoint Server 2010 User Profile Synchronization

On third place I’ll put the Technet article

http://technet.microsoft.com/en-us/library/ee721049.aspx

Good luck with UPS!

Devil

Thursday, August 5, 2010

How to Use Metadata Navigation in Enterprise Wiki Site (Sharepoint 2010)

If you want to use Metadata navigation tree in Enterprise Wiki Site, you have to do the following:

  • Activate Metadata Navigation and Filtering feature on site level

image

  • Navigate to Library settings page of your “Pages” library and select Metadata navigation settings
  • From “Configure Navigation Hierarchies” select “Wiki Categories” and click “Add” and “OK”

image

  • Navigate to Pages library again

http://<Your Wiki Site Url>/Pages/Forms/AllItems.aspx

clip_image001

But when you click on any of the pages on the right panel, the navigation tree will disappear. 

clip_image001[5]

You have to change the EnterpriseWiki.aspx page layout or better to create and deploy a new one (via Sharepoint Designer or wsp)

You have to include a reference to MetadataNavTree control and put it in some placeholder (PlaceHolderLeftActions) on the page layout aspx file.

  • Put this markup in the beginning of the page

<%@ Register TagPrefix="wssuc" TagName="MetadataNavTree" src="~/_controltemplates/MetadataNavTree.ascx" %>

  • Put this code in the end of page’s code, after the next </asp:Content> tag

<asp:Content id="Content1" runat="server" contentplaceholderid="PlaceHolderLeftActions">

<wssuc:MetadataNavTree id="mdnt" runat="server" />

</asp:Content>

The result is:

image

image

How to Fix Sharepoint 2010 DCOM 10016 Error on Windows Server 2008 R2

If you get DCOM error 10016 in your event error, it means, that you have to configure local activation permissions of IIS WAMREG admin Service for your farm account.

Open Component Services/Computers/My Computer/DCOM Config/IIS WAMREG admin Service , Properties –> Security tab

image

Ooops … all controls are inactive?!?! The picture was different in WS 2003 and 2008, but in 2008 R2…. Smile

Open “regedit” and search for

HKEY_CLASSES_ROOT\AppID\{61738644-F196-11D0-9953-00C04FD919C1}

Right click, “Permissions” and click “Advanced” button, open “Owner” tab

image

Select some of the listed names or browse for another user or group and finally click Apply

image

Now, you (or your group) can change the permissions for modification of the service

image image

 

After “OK”, try to reopen the “Component Services” console and open the properties window of IIS WAMREG admin Service. now the picture is a little bit different Smile

image

Tuesday, July 6, 2010

Telerik Components for Sharepoint 2010

In their ASP.NET AJAX Q2 Beta release, Telerik packaged RadEditor and RadGrid as standalone web parts for Sharepoint 2010.

“Need to use our AJAX controls in a custom Sharepoint 2007/2010 implementation? Not a problem at all. RadEditor, RadGrid and the rest of our ASP.NET AJAX components can also be plugged very easily into Sharepoint 2007/2010 visual/dynamic web parts, or placed directly into Sharepoint pages/user controls.”

Telerik Sharepoint 2010 Demo Site: http://sharepoint.telerik.com/Pages/default.aspx

You can play with RadGrid web part after login with:

User: .\sp2010visitor

Pass: sp2010visitor

Here http://sharepoint.telerik.com/silverlight/Pages/default.aspx you can find screen casts from Sahil Malik, how to use Telerik Silverlight controls in Sharepoint 2010, together with Sharepoint client object model. Enjoy! Smile

image

Wednesday, June 30, 2010

SQL Server 2008 R2 Community Launch

Yesterday (June, 29) we launched the SQL Server 2008 R2 in our local SQL&BI and Sharepoint user groups. The event started at 17 PM in business center ‘Iliev’. Together with Magi and Galin we delivered two presentations:

SQL Server 2008 R2 – Perception v/s Reality – Covering all new features in this release: Application and Multi-server Management, Master Data Services and StreamInsight

SharePoint 2010 and SQL Server 2008 R2 – a smooth integration for a complete BI Solution – PowerPivot and integration with Sharepoint 2010, Reporting Services and consumption of OData from PowerPivot.

You can click the presentation’s title to get the PPTX file.

30462_410925709790_643429790_4207202_8262334_n 36474_410926954790_643429790_4207241_826429_n

34612_410926734790_643429790_4207239_4947612_n 34531_410925454790_643429790_4207191_1927356_n

35397_410926214790_643429790_4207227_1797723_n

The Live Meeting recording of Magi’s sessions is here. Unfortunately, the record of mine presentation has been failed, but the next will be more successful, I promise! Smile

Friday, May 21, 2010

User Profile Synchronization Error MOSS MA not found

When I tried to define connection to my profile store (Active Directory), I got the error: “MOSS MA not found”. This article gave me a help, but solution was:

I went to Services console and started Forefront Identity Manager Service. After that I restarted ForeFront Identity Manager Synchronization Service.

The profile connection was created successfully! Smile

Tuesday, April 20, 2010

Capacity Planning for Sharepoint 2010

When Sharepoint 2010 RTM has been released on April 16th, the new Capacity Management site went live. There you can find earlier released architecture Visio documents and planning guides, as well as links to few recommendations from Technet.

Wednesday, March 31, 2010

MS Days 10 Presentations

Here you get my presentations for MS Days 2010 (Bulgaria). They are created with Office 2010 RC Smile

ms-days-10
Office 2010 trailer

Sharepoint 2010 for Developers

ECM with Sharepoint 2010

 

Saturday, March 6, 2010

Sharepoint 2010 RTM is Coming in April

Today, we officially announced that May 12th, 2010, is the launch date for SharePoint 2010 & Office 2010. In addition, we announced our intent to RTM (Release to Manufacturing) this April 2010. 

It’s an exciting time for us! We hope you can virtually join us on May 12th at 11am EST to listen to Stephen Elop, President of the Microsoft Business Division, announce the launch. You can register for the event @ http://sharepoint.microsoft.com/businessproductivity/proof/pages/2010-launch-events.aspx

Arpan Shah
Director, SharePoint

Link to Facebook announcement