This is for a table
Tuesday, 31 January 2012
Column does not exist
Monday, 30 January 2012
CustomActions with Javascript
Id="Ribbon.WikiPageTab.CustomGroup"
Location="CommandUI.Ribbon">
Location="Ribbon.WikiPageTab.Groups._children">
Id="Ribbon.WikiPageTab.CustomGroup"
Sequence="55"
Description="Custom Group"
Title="Custom"
Command="EnableCustomGroup"
Template="Ribbon.Templates.Flexible2">
Id="Ribbon.WikiPageTab.CustomGroup.Print"
Command="CustomGroupPrint"
Image32by32="/_layouts/IMAGES/print32x32.gif"
LabelText="Print"
TemplateAlias="o2"
Sequence="15" />
Location="Ribbon.WikiPageTab.Scaling._children">
Id="Ribbon.WikiPageTab.Scaling.CustomGroup.MaxSize"
Sequence="15"
GroupId="Ribbon.WikiPageTab.CustomGroup"
Size="LargeLarge" />
Command="EnableCustomGroup"
CommandAction="javascript:return true;" />
Command="CustomGroupPrint"
CommandAction="javascript:
function PrintWebPart()
{
var bolWebPartFound = false;
var TopMomTableElement = getElementEndsWithId('TopID');
var TableClassName = 'ms-listviewtable';
if(TopMomTableElement!=null)
{
// remove input tags
var inputTags = document.getElementsByTagName('INPUT');
var t = inputTags.length;
for (var i = 0; i < t; i++) {
inputTags[0].parentNode.removeChild(inputTags[0]);
}
var allTableTags=document.getElementsByTagName('TABLE');
var TableListHTML = '';
for (i=0; i < allTableTags.length; i++)
{
if (allTableTags[i].className==TableClassName)
{
TableListHTML = allTableTags[i].outerHTML;
}
}
var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
var dateString = day + '/' + month + '/' + year ;
var CSSSTYLE = '<style type=\'text/css\'>' +
'table.top { border:1px solid black; border-spacing: 0px;border-collapse:collapse;} td.top { border: 1px solid black; border-spacing:0px; font:100% arial,sans-serif; } ' +
'td.ms-vb2, td.ms-vb-user, .ms-vb-title, th.ms-vh2, th.ms-vh { border:1px solid black; border-spacing: 0px; font:90% arial,sans-serif; } ' +
' img {display: none} .s4-ctx {display: none} </style>';
var PrintingWindow = window.open('','PrintWebPart', 'width=800,height=600,scrollbars,resizable,menubar');
PrintingWindow.document.open();
PrintingWindow.document.write('<html><head> ' + CSSSTYLE + '</head><body>\n\n' + '<B> Printed Date: ' + dateString + '</B><BR/>' + TopMomTableElement.outerHTML + '<br/>' + TableListHTML +'</body></html>');
}
}
function getElementEndsWithId( endID )
{
var children = document.body.getElementsByTagName('TABLE');
var child;
var length = children.length;
for (var i = 0; i < length; i++)
{
child = children[i];
if(child.id.indexOf(endID)!=-1)
{
return child;
}
}
return null;
}
PrintWebPart();" />
Labels:
JavaScript/JQuery
Wednesday, 25 January 2012
CustomActions for Item Ribbon on Lists
For Generic Lists and Issue Lists
I get help from these,
http://johanolivier.blogspot.com/2010/08/sharepoint-2010-ribbon-enabled-web-part.html
http://www.thorntontechnical.com/tech/sharepoint/sharepoint-2010-context-menu-item-with-custom-code
I get help from these,
http://johanolivier.blogspot.com/2010/08/sharepoint-2010-ribbon-enabled-web-part.html
http://www.thorntontechnical.com/tech/sharepoint/sharepoint-2010-context-menu-item-with-custom-code
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="PrintActionMenu.PrintAction1"
RegistrationType="List"
RegistrationId="100"
GroupId="ActionsMenu"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="1000"
ImageUrl="/_layouts/images/MyIconImage_32x32.png"
Title="Print List 100 A">
<UrlAction Url="{SiteUrl}/_layouts/PrintList.aspx?list={ListId}"/>
</CustomAction>
<CustomAction Id="PrintActionMenu.PrintAction2"
RegistrationType="List"
RegistrationId="1100"
GroupId="ActionsMenu"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="1000"
ImageUrl="/_layouts/images/MyIconImage_32x32.png"
Title="Print List 1100 B">
<UrlAction Url="{SiteUrl}/_layouts/PrintList.aspx?list={ListId}"/>
</CustomAction>
<CustomAction
Id="PrintActionMenu.PrintAction3"
RegistrationType="List"
RegistrationId="100"
Location="CommandUI.Ribbon"
Sequence="1200">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.ListItem.Actions.Controls._children">
<Button
Id="Ribbon.Documents.HelloWorldButton"
Alt="Hello World"
Sequence="1200"
Command="Show_HelloWorld"
Image32by32="/_layouts/images/MyIconImage_32x32.png"
LabelText="Print List 100 C"
TemplateAlias="o1"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="Test"
CommandAction="javascript:alert('Hello World!');" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
<CustomAction
Id="PrintActionMenu.PrintAction4"
RegistrationType="List"
RegistrationId="1100"
Location="CommandUI.Ribbon"
Sequence="1300">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.ListItem.Actions.Controls._children">
<Button
Id="Ribbon.Documents.HelloWorldButton"
Alt="Prints Issue List"
Sequence="1300"
Command="Show_HelloWorld"
Image32by32="/_layouts/images/MyIconImage_32x32.png"
LabelText="Print List 1100 D"
TemplateAlias="o1"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="Print"
CommandAction="{SiteUrl}/_layouts/PrintList.aspx?list={ListId}"
/>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>
Labels:
CustomActions
Tuesday, 24 January 2012
Web Part CSS Round Tops SharePoint 2010
After some trial and error and reading from the internet, this is what I did for my round tops... I find that directly copy and pasting from the internet doesn't work without some personal tweaking.
Labels:
WebParts
Sunday, 22 January 2012
Linq multiple joins and group by
This is an example of joining 3 tables and grouping by, I am trying to figure out how to combine both into one query.
Using linqpad where you can download from here
Labels:
LINQ
LINQ joins of 3 tables
Here's a LINQ query to join 3 tables (Authors, Titleauthors, Title) from the PUBS example database
from auth in Authors
join tauth in Titleauthors on auth.Au_id equals tauth.Au_id
join atitle in Titles on tauth.Title_id equals atitle.Title_id
select new { AuthorName = auth.Au_fname + " " + auth.Au_lname , atitle.Title }
Labels:
LINQ
Monday, 16 January 2012
Friday, 13 January 2012
Error: The underlying provider failed on Open.
'Unable to display this Web Part' Error
I was shown a 'Unable to display this Web Part' error when trying to view a BDC list, this was the steps I took to get rid of that error.
Below the error was the ID 27c287c1-c37d-42d8-8c98-f28d87aa587e
I looked into the SharePoint logs found in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS and check the corresponding ID
This was shown,
01/13/2012 09:28:58.91 w3wp.exe (0x26B4) 0x3608 SharePoint Foundation Web Parts 89a1 High Error while executing web part: Microsoft.BusinessData.MetadataModel.InvalidMetadataObjectException: Cannot find Property with name 'bcdCompanyName' on the parent object. The parent object may be returned by the LobSystem (External System) or it is created to be sent to LobSystem as input. This Property is referred to by child TypeDescriptor with Name 'bcdCompanyName' and Id '292' on Parameter with Name 'returnParameter' on Method with Name 'ReadList' on Entity (External Content Type) with Name 'Entity1' in Namespace 'SalesBDCModel.BdcModel1'. at Microsoft.SharePoint.BusinessData.Infrastructure.DotNetTypeReflector.GetValueFromInstanceUsingChildTypeDescriptor(Object instance, ITypeDescriptor typeDescriptor) at Microsoft.SharePoint.BusinessData.Runtime.FieldValueHelpers.GetValue(Obje... 27c287c1-c37d-42d8-8c98-f28d87aa587e
I had the entity name wrong, after changing from bcd to bdc in the Entity Model, I was no longer seeing the error.
Below the error was the ID 27c287c1-c37d-42d8-8c98-f28d87aa587e
I looked into the SharePoint logs found in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS and check the corresponding ID
This was shown,
01/13/2012 09:28:58.91 w3wp.exe (0x26B4) 0x3608 SharePoint Foundation Web Parts 89a1 High Error while executing web part: Microsoft.BusinessData.MetadataModel.InvalidMetadataObjectException: Cannot find Property with name 'bcdCompanyName' on the parent object. The parent object may be returned by the LobSystem (External System) or it is created to be sent to LobSystem as input. This Property is referred to by child TypeDescriptor with Name 'bcdCompanyName' and Id '292' on Parameter with Name 'returnParameter' on Method with Name 'ReadList' on Entity (External Content Type) with Name 'Entity1' in Namespace 'SalesBDCModel.BdcModel1'. at Microsoft.SharePoint.BusinessData.Infrastructure.DotNetTypeReflector.GetValueFromInstanceUsingChildTypeDescriptor(Object instance, ITypeDescriptor typeDescriptor) at Microsoft.SharePoint.BusinessData.Runtime.FieldValueHelpers.GetValue(Obje... 27c287c1-c37d-42d8-8c98-f28d87aa587e
I had the entity name wrong, after changing from bcd to bdc in the Entity Model, I was no longer seeing the error.
Solving 'Access denied by Business Data Connectivity.'
When you get an
'Access denied by Business Data Connectivity.'
error when trying to access BDC list on SharePoint, this is what I do to resolve it.
Go to Central Administration
> Manage service applications
> Business Data Connectivity Service
> Set Object Permissions
> Add your login or/and All Authenticated Users
'Access denied by Business Data Connectivity.'
error when trying to access BDC list on SharePoint, this is what I do to resolve it.
Go to Central Administration
> Manage service applications
> Business Data Connectivity Service
> Set Object Permissions
> Add your login or/and All Authenticated Users
Wednesday, 11 January 2012
Working web.config for service.svc
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="Microsoft.ServiceModel.Samples.CalculatorService" behaviorConfiguration="default">
<endpoint address=""
binding="wsHttpBinding"
contract="Microsoft.ServiceModel.Samples.ICalculator" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="default">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Raising an event when user clicks send button in outlook
When user clicks on Send, the following has to be added in ThisAddIn_Startup if you wish to handle the event,
Then you will continue to add the implementation for
Application.ItemSend +=
new Outlook.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend);
Then you will continue to add the implementation for
Application_ItemSend(object Item, ref bool Cancel)
Labels:
VSTO
Tuesday, 10 January 2012
Setting Outlook subject field from a Ribbon control
The idea is that, when the Ribbon button is clicked, the subject field will be filled.
Outlook.Inspector inspector = Globals.ThisAddIn.Application.ActiveInspector();
if (inspector.CurrentItem is Outlook.MailItem)
{
Outlook.MailItem om = (Outlook.MailItem)inspector.CurrentItem;
om.Subject = "TESTING!";
}
Labels:
VSTO
Subscribe to:
Posts (Atom)