Archive Page 2

05
Feb
14

Deleting List or Library Fields Breaks Data View Web Part in SharePoint 2007

Okay, I know this is OLD 2007, but some folks are still running it!

This is actually a two-part fix. 

  1. Fix the data source so it isn’t referencing the deleted fields
  2. Fix the web part so it isn’t referencing deleted fields from the data source

Here’s the web part that is showing an error because field(s) were deleted from the underlying list (library).

image

The data source will not return any data because it is also messed up due to the deleted list fields.

image

You can find the datasource in the _fpdatasources folder.

image

Then you can edit it in XML or Text mode.  You probably need to check it out first, or you won’t be able to save it!

image

Fix the data source.  This involves finding the field in the data source XML that has been deleted.  In this example, we have found <FieldRef Name="Scorecard"> that has been encoded (e.g. &lt;).  Delete it, and be sure you get all the correct text deleted. 

image

Now you can see the data in the data source once again!

image

You need to fix the web part by finding the extra field(s) that are being referenced and remove them from the data source reference.

image

In the code view, find the <DataSources> tag and you can then locate the <datafields> section where the deleted list fields are still present.  You need to remove them as shown above.

image

 

 

References:

The server returned a non-specific error when trying to get data from the data source.  Check the format and content of your query and try again.  If the problem persists, contact the server administrator.

23
Jan
14

Creating a Link to Open a Word Document Content Type in SharePoint 2010

You might be familiar with creating a content type on a document library and associating a Word template with that content type.  When you do this, you end up with a very nice link in the Documents menu that fills in the blank, "I want to create a new ______."  In this case, I want to create a new ECCN Classification Document.

image

When Word opens up, it uses the template on the list content type so you can expose the content type columns as Quick Parts in Word.  If you’re not familiar with this process, it’s kind of a poor man’s form for SharePoint.

image

Once you’ve done this, you might want to create a link to use this on other pages and in other places…and least that’s what I wanted to do.

When you start looking around for a solution to this, you might find this post by Srini Sistla which is pretty much the route I originally went down.  It involves viewing the source on the page with the menu and attempting to replicate what the menu does.

image

This ends up with some JavaScript that runs CoreInvoke that then appears to wrap createNewDocumentWithRedirect.  Trying to read through all the encoded gibberish will make your head hurt, but you can do it and it will work. 

My goal was to make this as simple as possible and, assuming it was going to require some JavaScript to make it happen, I wanted it to be a lot more readable.  Also, I don’t want to include a lot of extra, hard-to-read and understand, code that doesn’t really add to the solution.  In this vein, I felt I should be able to execute createNewDocumentWithRedirect and not have to wrap it in anything else.  Perhaps I don’t understand fully what CoreInvoke is doing.  What I’ve found is it doesn’t appear to be doing much for the solution I need.

If you do a little research, you’ll find there is a pretty straightforward definition for the createNewDocumentWithRedirect function.  Perhaps the most difficult part of using any function is to know what to pass for each of the parameters.  Here’s where I’ll try and elaborate and make it easy for you.  Here’s the definition.

function createNewDocumentWithRedirect(strTemplate, strSaveLocation, strProgID, bXMLForm, strRedirectUrl, defaultItemOpen)

strTemplate – A string value that identifies the URL to the template file associated with the content type.

strSaveLocation – A string value that identifies the default save location you want Word to display when performing a save.

strProgID – A string value to the program ID (ProgID) SharePoint.OpenDocuments which identifies a registry entry that is associated with a CLSID.  Like the CLSID, the ProgID identifies a class but with less precision because it is not guaranteed to be globally unique.

bXMLForm – A boolean (true/false) indicating whether this is an XML form.  False for Word and other office documents.

strRedirectUrl – A string value that contains the URL to redirect to after closing Word.  NOTE:  I’m not positive this works when closing Word.  I haven’t been able to get it to work.  Does it require CoreInvoke?  I tried that and it didn’t work either.

defaultItemOpen – Specifies whether to open items in a client application or in the browser.  Not really sure if it has much affect on opening Word documents in this context, but a 0 means open in the thick client and 1 means open in the thin (web) client.

Here’s what the ProgID looks like in the registry.  You’ll see that SharePoint.OpenDocuments points to SharePoint.OpenDocuments5 which, in turn, points to the CLSID (unique identifier for the class).  Kinda’ like "there’s a hole in the bottom of the sea."

image

image

image

So, if we continue on and create an anchor <a> link with some JavaScript on the onclick event, it looks something like this, which is much easier to read.

NOTE:  If you copy and paste this be aware that the single quotes can get changed to the accent grave variety (not the ambidextrous single quote we are used to, the ')

<a onclick="createNewDocumentWithRedirect(‘https://yoursite.com/sites/WPL/CCL/Saved Records/Forms/ECCN Classification Document/ECCN Classification.docx’, ‘https://yoursite.com/sites/wpl/ccl/saved records’, ‘SharePoint.OpenDocuments’, false, ‘https://yoursite.com/sites/wpl/ccl&#8217;, 1);" href="#">createNewDocumentWithRedirect Test</a>

When you put this in a content editor web part in SharePoint 2010, it will encode the apostrophes and change them to '.

However, you’ll note that I didn’t have to encode the spaces in my links, and they work just fine.

So, what are these links anyway?  The first one, strTemplate, is the link to the template that was uploaded.  This is the link to the template on the list.  You can see this in SPD or look at the list content type page and copy it from the Edit Template link.

https://yoursite.com/sites/WPL/CCL/Saved Records/Forms/ECCN Classification Document/ECCN Classification.docx’

image

 

image

When you implement this in a content editor web part it looks something like this.  In this case I have two test links.  The "Word 2010" link uses the CoreInvoke function and the "createNewDocumentWithRedirect Test" link uses the createNewDocumentWithRedirect function.  Both seem to give me the same results, but the 2nd one is much easier to read and duplicate.

image

 

image

22
Dec
13

Installing Microsoft Office SharePoint Server 2007 on SQL Server 2012

Well, I got myself into a pickle.  I needed to create a SharePoint 2007 server instance within my domain so I could test some 2007/2010/2013 interactions.  It’s been a while since I installed 2007, but I thought it would be like riding a bicycle…you never really forget.  Turns out it was more like figuring out how to ride a unicycle.

I was planning on using best practices for all of the accounts necessary to perform a proper SharePoint installation.  And, for the most part, that went well.  The one thing I hadn’t planned on, however, was installing on SQL 2012.

I had recently upgraded my SQL VM to 2012 and that went without a hitch.  It was working fine, so out of sight, out of mind.  I started on my merry way.  I didn’t even consider whether MOSS 2007 would install on SQL 2012.  Hey, it’s SQL, right?  Well, not so fast, bucko!

The slipstreamed installation of 2007 w/SP2 actually went pretty well.  It was only after the installation and applying SP3 and some CU’s that I began to experience the incompatibilities, specifically in the SharePoint Products and Technologies Configuration Wizard.

sp_dboption is Deprecated and No Longer Exists in the Master Database

This was the first issue I had to overcome.  The configuration wizard calls sp_dboption but it no longer exists.  This was fairly easy to fix.  Simply get a copy of sp_dboption and add it back.  I present Exhibit A (sp_dboption) for your perusal.  (Skip to next topic)

USE [master]
GO
/****** Object: StoredProcedure [sys].[sp_dboption] Script Date: 12/08/2013 21:22:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [sp_dboption] -- 1999/08/09 18:25
@dbname sysname = NULL, -- database name to change
@optname varchar(35) = NULL, -- option name to turn on/off
@optvalue varchar(10) = NULL -- true or false
as
set nocount on

declare @dbid int -- dbid of the database
declare @catvalue int -- number of category option
declare @optcount int -- number of options like @optname
declare @allstatopts int -- bit map off all options stored in sysdatqabases.status
-- that can be set by sp_dboption.
declare @alloptopts int -- bit map off all options stored in sysdatqabases.status
-- that can be set by sp_dboption.
declare @allcatopts int -- bit map off all options stored in sysdatqabases.category
-- that can be set by sp_dboption.
declare @exec_stmt nvarchar(max)
declare @fulloptname varchar(35)
declare @alt_optname varchar(50)
declare @alt_optvalue varchar(30)
declare @optnameIn varchar(35)

select @optnameIn = @optname
,@optname = LOWER (@optname collate Latin1_General_CI_AS)

-- If no @dbname given, just list the possible dboptions.
-- Only certain status bits may be set or cleared by sp_dboption.

-- Get bitmap of all options that can be set by sp_dboption.
select @allstatopts=number from master.dbo.spt_values where type = 'D'
and name = 'ALL SETTABLE OPTIONS'

select @allcatopts=number from master.dbo.spt_values where type = 'DC'
and name = 'ALL SETTABLE OPTIONS'

select @alloptopts=number from master.dbo.spt_values where type = 'D2'
and name = 'ALL SETTABLE OPTIONS'

if @dbname is null
begin
select 'Settable database options:' = name
from master.dbo.spt_values
where (type = 'D'
and number & @allstatopts <> 0
and number not in (0,@allstatopts)) -- Eliminate non-option entries
or (type = 'DC'
and number & @allcatopts <> 0
and number not in (0,@allcatopts))
or (type = 'D2'
and number & @alloptopts <> 0
and number not in (0,@alloptopts))
order by name
return (0)
end

-- Verify the database name and get info
select @dbid = dbid
from master.dbo.sysdatabases
where name = @dbname

-- If @dbname not found, say so and list the databases.
if @dbid is null
begin
raiserror(15010,-1,-1,@dbname)
print ' '
select 'Available databases:' = name
from master.dbo.sysdatabases
return (1)
end

-- If no option was supplied, display current settings.
if @optname is null
begin
select 'The following options are set:' = v.name
from master.dbo.spt_values v, master.dbo.sysdatabases d
where d.name=@dbname
and ((number & @allstatopts <> 0
and number not in (-1,@allstatopts)
and v.type = 'D'
and (v.number & d.status)=v.number)
or (number & @allcatopts <> 0
and number not in (-1,@allcatopts)
and v.type = 'DC'
and d.category & v.number <> 0)
or (number & @alloptopts <> 0
and number not in (-1,@alloptopts)
and v.type = 'D2'
and d.status2 & v.number <> 0))
return(0)
end

if @optvalue is not null and lower(@optvalue) not in ('true', 'false', 'on', 'off')
begin
raiserror(15241,-1,-1)
return (1)
end

-- Use @optname and try to find the right option.
-- If there isn't just one, print appropriate diagnostics and return.
select @optcount = count(*) ,@fulloptname = min(name)
from master.dbo.spt_values
where lower(name collate Latin1_General_CI_AS) like '
%' + @optname + '%'
and ((type = '
D'
and number & @allstatopts <> 0
and number not in (-1,@allstatopts))
or (type = '
DC'
and number & @allcatopts <> 0
and number not in (-1,@allcatopts))
or (type = '
D2'
and number & @alloptopts <> 0
and number not in (-1,@alloptopts)))

-- If no option, show the user what the options are.
if @optcount = 0
begin
raiserror(15011,-1,-1,@optnameIn)
print '
'

select '
Settable database options:' = name
from master.dbo.spt_values
where (type = '
D'
and number & @allstatopts <> 0
and number not in (-1,@allstatopts)) -- Eliminate non-option entries
or (type = '
DC'
and number & @allcatopts <> 0
and number not in (-1,@allcatopts))
or (type = '
D2'
and number & @alloptopts <> 0
and number not in (-1,@alloptopts))
order by name

return (1)
end

-- If more than one option like @optname, show the duplicates and return.
if @optcount > 1
begin
raiserror(15242,-1,-1,@optnameIn)
print '
'

select duplicate_options = name
from master.dbo.spt_values
where lower(name collate Latin1_General_CI_AS) like '
%' + @optname + '%'
and ((type = '
D'
and number & @allstatopts <> 0
and number not in (-1,@allstatopts))
or (type = '
DC'
and number & @allcatopts <> 0
and number not in (-1,@allcatopts))
or (type = '
D2'
and number & @alloptopts <> 0
and number not in (-1,@alloptopts))
)
return (1)
end

-- Just want to see current setting of specified option.
if @optvalue is null
begin
select OptionName = v.name,
CurrentSetting = (case
when ( ((v.number & d.status) = v.number
and v.type = '
D')
or (d.category & v.number <> 0
and v.type = '
DC')
or (d.status2 & v.number <> 0
and v.type = '
D2')
)
then '
ON'
when not
( ((v.number & d.status) = v.number
and v.type = '
D')
or (d.category & v.number <> 0
and v.type = '
DC')
or (d.status2 & v.number <> 0
and v.type = '
D2')
)
then '
OFF'
end)
from master.dbo.spt_values v, master.dbo.sysdatabases d
where d.name=@dbname
and ((v.number & @allstatopts <> 0
and v.number not in (-1,@allstatopts) -- Eliminate non-option entries
and v.type = '
D')
or (v.number & @allcatopts <> 0
and v.number not in (-1,@allcatopts) -- Eliminate non-option entries
and v.type = '
DC')
or (v.number & @alloptopts <> 0
and v.number not in (-1,@alloptopts) -- Eliminate non-option entries
and v.type = '
D2')
)
and lower(v.name) = lower(@fulloptname)

return (0)
end

select @catvalue = 0
select @catvalue = number
from master.dbo.spt_values
where lower(name) = lower(@fulloptname)
and type = '
DC'

-- if setting replication option, call sp_replicationdboption directly
if (@catvalue <> 0)
begin
select @alt_optvalue = (case lower(@optvalue)
when '
true' then 'true'
when '
on' then 'true'
else '
false'
end)

select @alt_optname = (case @catvalue
when 1 then '
publish'
when 2 then '
subscribe'
when 4 then '
merge publish'
else quotename(@fulloptname, '
''')
end)

select @exec_stmt = quotename(@dbname, '
[') + '.dbo.sp_replicationdboption'

EXEC @exec_stmt @dbname, @alt_optname, @alt_optvalue
return (0)
end


-- call Alter Database to set options

-- set option value in alter database
select @alt_optvalue = (case lower(@optvalue)
when '
true' then 'ON'
when '
on' then 'ON'
else '
OFF'
end)

-- set option name in alter database
select @fulloptname = lower(@fulloptname)
select @alt_optname = (case @fulloptname
when '
auto create statistics' then 'AUTO_CREATE_STATISTICS'
when '
auto update statistics' then 'AUTO_UPDATE_STATISTICS'
when '
autoclose' then 'AUTO_CLOSE'
when '
autoshrink' then 'AUTO_SHRINK'
when '
ansi padding' then 'ANSI_PADDING'
when '
arithabort' then 'ARITHABORT'
when '
numeric roundabort' then 'NUMERIC_ROUNDABORT'
when '
ansi null default' then 'ANSI_NULL_DEFAULT'
when '
ansi nulls' then 'ANSI_NULLS'
when '
ansi warnings' then 'ANSI_WARNINGS'
when '
concat null yields null' then 'CONCAT_NULL_YIELDS_NULL'
when '
cursor close on commit' then 'CURSOR_CLOSE_ON_COMMIT'
when '
torn page detection' then 'TORN_PAGE_DETECTION'
when '
quoted identifier' then 'QUOTED_IDENTIFIER'
when '
recursive triggers' then 'RECURSIVE_TRIGGERS'
when '
default to local cursor' then 'CURSOR_DEFAULT'
when '
offline' then (case @alt_optvalue when 'ON' then 'OFFLINE' else 'ONLINE' end)
when '
read only' then (case @alt_optvalue when 'ON' then 'READ_ONLY' else 'READ_WRITE' end)
when '
dbo use only' then (case @alt_optvalue when 'ON' then 'RESTRICTED_USER' else 'MULTI_USER' end)
when '
single user' then (case @alt_optvalue when 'ON' then 'SINGLE_USER' else 'MULTI_USER' end)
when '
select into/bulkcopy' then 'RECOVERY'
when '
trunc. log on chkpt.' then 'RECOVERY'
when '
db chaining' then 'DB_CHAINING'
else @alt_optname
end)

if @fulloptname = '
dbo use only'
begin
if @alt_optvalue = '
ON'
begin
if databaseproperty(@dbname, '
IsSingleUser') = 1
begin
raiserror(5066,-1,-1);
return (1)
end
end
else
begin
if databaseproperty(@dbname, '
IsDBOOnly') = 0
return (0)
end
end

if @fulloptname = '
single user'
begin
if @alt_optvalue = '
ON'
begin
if databaseproperty(@dbname, '
ISDBOOnly') = 1
begin
raiserror(5066,-1,-1);
return (1)
end
end
else
begin
if databaseproperty(@dbname, '
IsSingleUser') = 0
return (0)
end
end

select @alt_optvalue = (case @fulloptname
when '
default to local cursor' then (case @alt_optvalue when 'ON' then 'LOCAL' else 'GLOBAL' end)
when '
offline' then ''
when '
read only' then ''
when '
dbo use only' then ''
when '
single user' then ''
else @alt_optvalue
end)

if lower(@fulloptname) = '
select into/bulkcopy'
begin
if @alt_optvalue = '
ON'
begin
if databaseproperty(@dbname, '
IsTrunclog') = 1
select @alt_optvalue = '
RECMODEL_70BACKCOMP'
else
select @alt_optvalue = '
BULK_LOGGED'
end
else
begin
if databaseproperty(@dbname, '
IsTrunclog') = 1
select @alt_optvalue = '
SIMPLE'
else
select @alt_optvalue = '
FULL'
end
end

if lower(@fulloptname) = '
trunc. log on chkpt.'
begin
if @alt_optvalue = '
ON'
begin
if databaseproperty(@dbname, '
IsBulkCopy') = 1
select @alt_optvalue = '
RECMODEL_70BACKCOMP'
else
select @alt_optvalue = '
SIMPLE'
end
else
begin
if databaseproperty(@dbname, '
IsBulkCopy') = 1
select @alt_optvalue = '
BULK_LOGGED'
else
select @alt_optvalue = '
FULL'
end
end

-- construct the ALTER DATABASE command string
select @exec_stmt = '
ALTER DATABASE ' + quotename(@dbname) + ' SET ' + @alt_optname + ' ' + @alt_optvalue + ' WITH NO_WAIT'
EXEC (@exec_stmt)

if @@error <> 0
begin
raiserror(15627,-1,-1)
return (1)
end

return (0) -- sp_dboption
 

dbo.trace_xe_action_map Moved from dbo to sys Schema

This next issue took me quite  a while longer to figure out. 

Kudos to Dan Guzman, SQL Server MVP, (http://www.dbdelta.com) for helping me figure this one out.  Without dragging this out too much, I was getting this error when running the configuration wizard:  Invalid object name ‘dbo.trace_xe_action_map’.

image

This pointed back to system table, dbo.trace_xe_action_map.  From there I found out it, as well as trace_xe_event_map, have been moved to the sys schema and here’s some of the original discussion by Aaron Bertrand and the SQL team.  Well, in case you wondered, it did make it into the final release!

I thought creating a synonym would fix this quickly and easily.  If I had only known what I know now about synonyms!  You have to create them in the context of the database in which they will be called.  What does this mean?  You need to create the synonym for each table the SharePoint Products and Technologies Configuration Wizard will upgrade, as dbo.trace_xe_action_map is referenced within each database context during the process.

I started troubleshooting this first by using SQL Profiler, as I wanted to see what the wizard was doing.  This is what SQL Profiler trapped during the wizard execution.

declare @p3 int
set @p3=NULL
exec sp_executesql N’SELECT @RowCount=COUNT(1) FROM [dbo].[trace_xe_action_map] WITH (NOLOCK)’,N’@RowCount int output’,@RowCount=@p3 output
select @p3

The first database where I fixed the issue was on the AdminContent database. 

use [SharePoint_AdminContent_a974ce72-f4c4-43ff-a3bc-fe08e4e0a553]

go

CREATE SYNONYM [dbo].[trace_xe_action_map] FOR [sys].[trace_xe_action_map];

CREATE SYNONYM [dbo].[trace_xe_event_map] FOR [sys].[trace_xe_event_map];

go

That got me up to task 8 of 9 but then I started getting other errors that were not as well identified.  I was seeing issues such as this one:

The B2B upgrader timer job failed.

clip_image001

Reading some other discussion threads, I invoked psconfig as follows:

psconfig -cmd upgrade -inplace b2b -force -wait

But I continued to get errors.  It was only after looking at the Upgrade text file in the logs folder (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\LOGS) that I began to see the source of the additional errors.

image

This is where I noticed the Invalid object name error on dbo.trace_xe_action_map that was occurring upon every database context switch. 

[SPManager] [ERROR] [12/22/2013 8:33:39 PM]: Upgrade [SPContentDatabase Name=WSS_Content_RXSP2007 Parent=SPDatabaseServiceInstance] failed.
[SPManager] [ERROR] [12/22/2013 8:33:39 PM]: Invalid object name 'dbo.trace_xe_action_map'.
[SPManager] [ERROR] [12/22/2013 8:33:39 PM]: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.SharePoint.Utilities.SqlSession.ExecuteNonQuery(SqlCommand command)
at Microsoft.SharePoint.Upgrade.SPSqlCommandFactory.GetRowCount(String strTable)
at Microsoft.SharePoint.Upgrade.SPDatabaseWssSequence.LogTableRowCounts()
at Microsoft.SharePoint.Upgrade.SPDatabaseWssSequence.PreUpgrade()
at Microsoft.SharePoint.Upgrade.SPContentDatabaseSequence.PreUpgrade()
at Microsoft.SharePoint.Upgrade.SPManager.Upgrade(Object o, Boolean bRecurse)
When you run psconfig, you see the count of the successful/unsuccessful configuration settings.  This gives you an idea of how many of these errors you need to fix.
 

image

 

So, what I did was create a synonym in the context of each database as follows:

use [SharePoint_AdminContent_a974ce72-f4c4-43ff-a3bc-fe08e4e0a553]
go
CREATE SYNONYM [dbo].[trace_xe_action_map] FOR [sys].[trace_xe_action_map];
CREATE SYNONYM [dbo].[trace_xe_event_map] FOR [sys].[trace_xe_event_map];
go
use [WSS_Content_RXSP2007_MySite]
go
CREATE SYNONYM [dbo].[trace_xe_action_map] FOR [sys].[trace_xe_action_map];
CREATE SYNONYM [dbo].[trace_xe_event_map] FOR [sys].[trace_xe_event_map];
go
use [SharePoint_Config_RXSP2007]
go
CREATE SYNONYM [dbo].[trace_xe_action_map] FOR [sys].[trace_xe_action_map];
CREATE SYNONYM [dbo].[trace_xe_event_map] FOR [sys].[trace_xe_event_map];
go
use [WSS_Content_RXSP2007]
go
CREATE SYNONYM [dbo].[trace_xe_action_map] FOR [sys].[trace_xe_action_map];
CREATE SYNONYM [dbo].[trace_xe_event_map] FOR [sys].[trace_xe_event_map];
go
 

After creating the synonyms in each database, psconfig ran successfully.

clip_image001[5]

 

And more importantly, the configuration wizard completed successfully!

clip_image002

22
Jul
13

KB2844286 on SharePoint 2010 Breaks Web Parts

 

Came in to our project management site only to find several pages with data views (DVWP) throwing an error.

image

The logs have an error for each web part.

07/22/2013 10:20:26.95    w3wp.exe (0×2634)    0×2730    SharePoint Foundation    Web Parts    89a1    High    Error while executing web part: System.NullReferenceException: Object reference not set to an instance of an object.     at System.Xml.Xsl.XslCompiledTransform.Load(MethodInfo executeMethod, Byte[] queryData, Type[] earlyBoundTypes)     at Microsoft.Xslt.STransform.GetCompiledTransform()     at Microsoft.SharePoint.WebPartPages.BaseXsltListWebPart.LoadXslCompiledTransform(WSSXmlUrlResolver someXmlResolver)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.GetXslCompiledTransform()     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)    3b2167ff-b5ed-4e4d-9797-87f715418136

Some googling turned up several articles about KB2844286 and SharePoint 2010.

http://techchucker.wordpress.com/2013/07/16/issue-kb2844286-security-update-on-sharepoint-2010/

http://social.msdn.microsoft.com/Forums/wpapps/en-US/871a0661-05d0-4f3a-b66d-2504552142bd/error-while-executing-web-part-systemnullreferenceexception-object-reference-not-set-to-an

http://social.technet.microsoft.com/Forums/sharepoint/en-US/6f5e2e94-e756-436f-af8e-68b5ca8a9290/error-while-executing-web-part-systeminvalidprogramexception-common-language-runtime-detected-an

http://sharepointeric.blogspot.com/2013/07/kb2844286-security-update-on-sharepoint.html

We are currently checking this out to see if it really fixes our issue…

…and the answer is "YES!"

10
Jul
13

InfoPath 2010 Form: Redirect to your source Page once form has been closed

I’ve noticed that this topic has been asked about by many people and I thought I’d offer up what I did to eliminate this problem.

For those not familiar with this issue, when you create an InfoPath form and create Submit and Cancel buttons, it is likely you want the Cancel operation to redirect or return you to your originating page.  Some folks want to display a "Thank you" page after a submit and then return to their originating page.  While you can do this with scripting, such as JavaScript found here, I think I have a simpler method that doesn’t require you write any custom JavaScript (although it does use a built-in SharePoint JavaScript function).

The trick I used was to open the form in a dialog.  That way, when you click Cancel, the dialog is dismissed and you remain on the same page from which you opened the dialog.

Here’s some example html.

<a href="javascript:OpenPopUpPage(‘uploadfile.aspx?ProjectID={@PMO_x0020_Project_x0020_ID}’, RefreshPage);">

In this case, uploadfile.aspx is located in the pages library and is a custom page with an InfoPath form web part on it.  The custom page also has a URL filter on it that is connected to the form.  The parameter, ProjectID, is a URL parameter that is passed to the form through a web part connection.

Here is an image that has the above hyperlink (Upload File) anchored to it.

image

This opens the page below in a dialog.  Notice how the Project ID is defaulted on the form using a URL parameter that is sent to the form web part using a web part connection.

image

When Cancel is clicked, the dialog is dismissed and we’re right back where we started.

For the "Thank you" page, I’d recommend creating another view in InfoPath and simply switching views after the submit with your "thank you" text and provide an OK button to close the form.

06
Mar
13

Reordering and Hiding Fields and Passing URL Parameters on a New Item Form in SharePoint 2010

Let’s say you are creating a new item form using SPD 2010 and you don’t have InfoPath because the company didn’t purchase the Enterprise version of SharePoint.  Your goal is to pass a URL parameter to the new item form from some other part of the SharePoint application you are building.  Perhaps the link that contains the URL parameter was created by a workflow (hint hint).

image

You insert the custom list form like this.

image

The goal is to move this field down to the end of the form to get it out of the way.

image

You select the row and cut it for repositioning to the end of the form.

image

Now you’ve got it at the bottom of your form.

image

Now you test your form (before adding the parameter to pass) and it "works" but it doesn’t correctly save the data in the field you relocated.

The correct way to do this is to delete the field row at the top, add a new row at the bottom and insert a new text field and bind it to the column.

image

Bind the Data field to the column and format it as a Text Box.

image

Under Options, select Parameters and add a New Parameter, giving it a name that is memorable for you.  Then, bind it to the Query String variable of your choice.

image

With your text box selected, find the text property and change it from @Fieldname to $Parametername.

image

If you don’t get the name correct, you’ll see an error displayed instead of your form.

image

If you want to hide the field completely on the form to eliminate any human intervention, add class=ms-hidden to the table row.

image

25
Nov
12

Unsupported Expression in InfoPath 2010

 

This is a weird one.

Situation:

Going back to a SharePoint 2007 site formerly published with InfoPath 2007.  Downloaded the form template and made some changes.  When I went to re-publish I encountered an “unsupported expression” error.

image

The actual long message was as follows.

The following expression could not be parsed because of a syntax error or because it uses an undefined namespace prefix or unsupported function:  pc:DisplayName

image

This appeared to have been coming from one of the people pickers (circa 2007 variety) but copying the Xpath on each of them yielded no easily identifiable pc:DisplayName.

/my:myFields/my:EmployeeManager/my:Person/my:DisplayName

/my:myFields/my:EmployeeGroup/my:TerminatingEmployee/my:Person/my:DisplayName

I went back to the original template with no changes and it didn’t throw the same error during publishing.

I changed the Form type from Web Browser Form (InfoPath 2007) to InfoPath 2007 Filler Form and attempted publishing.  The error went away.

image

So, I changed it back to Web Browser Form (InfoPath 2007) again…the way it originally was.  The error stayed away and I published the form. 

However, after publishing, the error came back.  Sad smile  So I decided to look “under the covers.”

I saved the XSN as source files and looked within all the files.  I was able to find where the pc: schema infiltrated my form template.  Within view1.xsl I found the offending pc:DisplayName, and all the other related pc: references. 

image

I’m not sure how this made its way into the form template, as I never specifically made this change, nor do I know how one would force this. 

</xsl:if>

                                        <param NAME="ButtonFont" VALUE="Verdana,12,0,400,0,0,0"/>

                                        <param NAME="ButtonText" VALUE=""/>

                                        <param NAME="DisplayNameXPath" VALUE="pc:DisplayName"/>

                                        <param NAME="ObjectIdXPath" VALUE="pc:AccountId"/>

                                        <param NAME="ObjectTypeXPath" VALUE="pc:AccountType"/>

                                        <param NAME="SiteUrlXPath" VALUE="/Context/@siteUrl"/>

                                        <param NAME="SiteUrlDataSource" VALUE="Context"/>

                                        <param NAME="NewNodeTemplate" VALUE="&lt;pc:Person xmlns:pc=&quot;http://schemas.microsoft.com/office/infopath/2007/PartnerControls&quot;&gt;
    &lt;pc:DisplayName&gt;&lt;/pc:DisplayName&gt;
    &lt;pc:AccountId&gt;&lt;/pc:AccountId&gt;
    &lt;pc:AccountType&gt;&lt;/pc:AccountType&gt;
&lt;/pc:Person&gt;"/>

                                        <param NAME="BackgroundColor" VALUE="2147483653"/>

                                        <param NAME="MaxLines" VALUE="4"/>

                                        <param NAME="Direction" VALUE="0"/>

I did a simple “find and replace” on all the pc: occurrences with my: and saved and tested my work.  All appears to be okay.

Sure would be nice to know how this happens!




Asif Rehmani’s SharePoint Videos

SharePoint-Videos

Click to access a wealth of SharePoint videos

SharePoint Rx

SharePoint Rx Home

Categories

Posts by Date

November 2014
M T W T F S S
« Oct    
 12
3456789
10111213141516
17181920212223
24252627282930
Support Wikipedia

Follow

Get every new post delivered to your Inbox.