Outlook add-in Office object is undefined - outlook-addin

I'm having a really hard time trying to find any documentation for Outlook add-ins development.
I want to use the Office object to access the current message attachment files from within the add-in, but Office is always undefined.
I have the following block in my manifest, as it's shown on the website:
<OfficeApp
xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0"
xsi:type="MailApp">
And also the following line in my script before attempting to access the Office object:
<script src="https://appsforoffice.microsoft.com/lib/1/hosted/Office.js" type="text/javascript"></script>
My requirements are just
<Requirements>
<Sets>
<Set Name="Mailbox" MinVersion="1.1" />
</Sets>
</Requirements>
After just defining those the Office object seems to exist on the official site:
if ( Office.context.requirements.isSetSupported( RequirementSetName, VersionNumber ) )
What am I missing? I still get the undefined error for Office, and haven't found anything about how to make it work.
Thank you so so much in advance!

Per Office.js documentation ...
If you fail to include an Office.initialize event handler, your add-in may raise an error when it starts.
I believe the "Checking the load status" document will be great way to start.

Related

How to create a DNN widget?

If I understood correctly, DNN widget is a way to add a js to every page on the website using module or theme. Right?
My goal evantually is to add a js to every page on a portal and preferably to do that via module that has no need to be added to every page manually.
My plan B is adding module and using setting "Display Module on All Pages", but widget seems to be a better way to do that.
At first I've tried to use this instruction. I've added the YourCompany.Widgets.SampleWidget.js file to root of existing DNN module. Also in the .dnn manifest file inside components tag I've added another component like this:
<component type="Widget">
<widgetFiles>
<basePath>YourCompany</basePath>
<widgetFile>
<name>YourCompany.Widgets.SampleWidget.js</name>
</widgetFile>
<widgetFile>
<name>license.txt</name>
</widgetFile>
<widgetFile>
<name>releasenotes.txt</name>
</widgetFile>
</widgetFiles>
</component>
I've got this error on module installation:
Failure File specified in the dnn could not be found in the zip file: - D:\Projects\website.com.ua\Host\Install\Temp\vp1vioj1\YourCompany.Widgets.SampleWidget.js
vp1vioj1 part is changing every time (seems like it's some unique id that is generating on module install).
Then I tried to place this widget component inside another package tag after checking this article. Like this:
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="ModuleName" type="Module" version="00.00.01">
<!-- some module content here -->
</package>
<package name="YourCompany.SampleWidget" type="Widget" version="00.00.01">
<components>
<component type="Widget">
<widgetFiles>
<basePath>YourCompany</basePath>
<widgetFile>
<name>YourCompany.Widgets.SampleWidget.js</name>
</widgetFile>
</widgetFiles>
</component>
</components>
</package>
</packages>
</dotnetnuke>
But I still got the same error on install. I didn't find any other instructions or documentations regarding widgets. When I tried to check the DNN source code - it seems to be also very time consuming and hard way.
So could you please help me to clarify this?
Support for Widgets in DNN Platformnwas dropped a number of years ago.
Your best option if you want something ok all pages would either be to look at a SkinObject, like the breadcrumb or Login for example. Or a traditional module but marking it “display on all pages”
First, you might want to take a look at the concept of DNN Extensions and how they are built and packaged.
If examples of versions DNN extensions, https://github.com/WillStrohl/dnnextensions. The examples include a widget. So check it out.
Now, what you posted looks like a .dnn file, which the the manifest file that is intended to be a part of a packaged DNN extension. Code and other bits and pieces go into the packaged extension (really a specially named zip file). The packaged extension is installed into your DNN installation via the Extensions Persona Bar page (click the Install Extension there).
From my experience with DNN (2006 to now), I believe that I can say that a DNN Widget is something that I've never had anything to do with. So, you may be barking up an old any dying tree in the project.
If you want something included on every page, it makes more sense to include it in the theme (skin). If you want a javascript file, add that to your theme project and have the .ascx files include it, probably using https://docs.dnncommunity.org/api/DotNetNuke.Web.Client.ClientResourceManagement.html (see https://docs.dnncommunity.org/api/DotNetNuke.Web.Client.ClientResourceManagement.html)
But, if you are determined to use a widget, start with https://www.kalyani.com/blog/2009/12/25/dotnetnuke-widgets-guide-part-1-of-4/

VS13/VS15 - can't import SQL snippet

I would like to create SQL snippet in VS2013 and VS2015. I don't know why, but I've got an error while importing (in both of VS):
"C:\sql.snippet: Missing or unspecified Language attribute"
My snippet:
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2008/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>
My Snippet
</Title>
</Header>
<Snippet>
<Code Language="SQL">
<![CDATA[select * from MyTable]]>
</Code>
</Snippet>
</CodeSnippet>
What's wrong?
The language SQL should be OK https://msdn.microsoft.com/en-US/library/ms171418.aspx#code
I tried to add this snippet to language "Miscrosoft SQL Server Data Tools, T-SQl..."
If I've changed the language attribute to e.g. CSharp it works.
Instead of:
<Code Language="SQL">
Write:
<Code Language="SQL_SSDT">
Visual Studio supports only MSSQL Server Data Tools & T-SQL Language Scripts, not SQL like SSMS does.
Try this.
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>
My Snippet
</Title>
</Header>
<Snippet>
<Code Language="SQL">
<![CDATA[select * from MyTable]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
You could also check this out if it works but still gives a warning.
http://providersweb.blogspot.se/2016/01/visual-studio-snippets-missing-or.html
I have been getting a list of messages in the Snippets output window
when I load a project that a number of snippets had a 'missing or
unspecified language attribute' and could not figure out why these
messages appeared. I had checked the Language attribute on the
snippets and they were correct, but still got the message. I had set
up folders for each language type, but still got the messages. I
finally figured out that I had specified they all were VB snippets in
the Snippet manager and those that were not VB would cause the
messages in the output window, ie when loading a VB project, the
CSharp snippets would generate the error message. I fixed this by
going into the snippet manager and specifying the Language, VB or
CSharp, and adding the snippets to the correct language and removing
them from the invalid language. And now these messages of invalid
language attributes do not appear on my output screen.
The language attribute value you used, SQL, is correct. From the VS2015 Code Snippets Schema Reference:
Errors such as you're seeing can happen if you're editing a snippet file directly in one of the folders known by the Code Snippets Manager. Evidently Visual Studio holds its own metadata in addition to what's in the snippet XML itself. For this reason, it can be best to do the edits in a temporary folder and then use the Import button.
For example, I kept getting the error "Missing or unspecified Language attribute" when saving any edit to my new C# snippet in the My Code Snippets folder—or so I thought. Turned out I was in the Visual Basic\My Code Snippets folder, and there's also a Visual C#\My Code Snippets folder which is where I should have been. This was a silly mistake but it illustrates that the "Language" XML attribute isn't enough, as Visual Studio has its own internal conventions to do with different folders for different snippet types (and who knows what else) which all happens when the Import button is used.
I removed my snippet file to a temporary location, and then added it from there using the Import button. As soon as I did this, the problem went away and the snippet started working normally.

SharePoint 2010 to 2013 SharePoint Migration issues

I recently migrated custom WebPart template solution (wsp), which has custom list definition, from SP2010 to SP2013 using Visual Studio 2013. Set the Assembly Version to 15 and compiled over .Net Framework 4.5. The deploymnet was successful. But there are 2 problems:
1. When I created site using the custom template that was just deployed, the page displays cluttered icons, attached screen shots. Also when trying to add permission to the site, a whole bunch of colorful cluttered icons appear on the site's Permissions page.
2. The other issue is, some of the CSS, specifically the ms-WPxxxxxxxx (like WPTitle, WPHeader etc) are being inherited, probably from corev4.css. That’s what View Source shows. The custom CSS is defined in the main page (CustomDefault.aspx) with “!important” tag, but that didn’t seem to be of any use.
The same solution was working perfect on SP2010.
Suspect mostly (1) is related to (2), I may be wrong.
To resolve (1), as advised by SP folks from MSDN Community forum, I changed the default master page to Oslo.master ==> that cleared the cluttering icons, but CSS and Javascripts werent working. So I had to revert.
I also tried changing the "../_layouts/.." to "../_layouts/15/..", that didnt make any difference.
MSDN Community Thread:
https://social.msdn.microsoft.com/Forums/office/en-US/f9199e0c-972b-45b9-b8fb-772028bc22d9/cluttered-icons-in-sharepoint-2013-post-migration-from-sp2010?forum=sharepointdevelopmentprevious#74fb3648-9776-4f68-82ba-b212102a1492
Any help will be appreciated.
enter image description here
After a long battle, I finally fixed this problem. Found that the 'onet.xml' in the SiteDefinition module was referring to SharePoint 2010 master page, v4.master. Since this was another project, I did not have a clue that this file will have references to SP2010 resources. Many blogs suggested only to change the resources path like '/_layouts/' to '/_layouts/15/' and the '/ControlTemplate/' to '/ControlTemplate/15/' but not seen anyone mentioning about master page change. Probably may not be the case for a completely out-of-box solution. So search for 'v4.master' (SP2010), in the project solution, if found, change it to your custom master page, if you have one, or to the default master page. But if you have used any other master page or a custom master page that was exclusively meant for SP2010 or an older version of SharePoint, you would have to choose an equivalent one or customize it to make it compatible with SP2013.
So here's the code snippet that was changed and that got rid of the cluttering icons, hope it helps someone out there.
<!-- <Configuration ID="-1" Name="NewWeb" MasterUrl="_catalogs/masterpage/**v4.master**" />
<Configuration ID="0" Name="Default" MasterUrl="_catalogs/masterpage/**v4.master**">
<Configuration ID="1" Name="Blank" MasterUrl="_catalogs/masterpage/**v4.master**">
<Configuration ID="2" Name="DWS" MasterUrl="_catalogs/masterpage/**v4.master**"> -->
<Configuration ID="1" Name="NewWeb" MasterUrl="~masterurl/**default.master**" />
<Configuration ID="0" Name="Default" MasterUrl="~masterurl/*default.master*">
<Configuration ID="1" Name="Blank" MasterUrl="~masterurl/**default.master**">
<Configuration ID="2" Name="DWS" MasterUrl="~masterurl/**default.master**">

SDL Trados Studio XLIFF global attribute has been already declared

Not sure if this is the right place to ask the question, but...
I've got the following xliff file:
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file original="file1.txt" datatype="plaintext" source-language="de-de" target-language="en-us">
<body>
<trans-unit id="unit_5">
<source xml:lang="de">unit_5</source>
</trans-unit>
</body>
</file>
</xliff>
I try to open the document as "translate single document" and get the following error from the image below. What might it be?.
I just opened your xliff file in Trados Studio 2014 (SP1) without any error messages coming up. I am afraid I do not really understand what Studio was complaining about for you: the file looks fine to me.
Did you try to disable schema validation in the file type settings for XLIFF, just as a workaround?
Best,
Jenszcz
Generally, file[source-language] and trans-unit[xml:lang] should have the same value. I'm not sure if it's allowed to use different notations (de, de-de).
Also, I've found Trados to be a bit strict and sometimes you'll see that even if the specs allow for some elements to be missing, in some cases Trados still expects them to be present. I'd try putting the target node inside trans-unit and see if it works.
From the XLIFF 1.2 spec:
The optional xml:lang attribute is used to specify the content language of the <source> this should always match source-language as a child of trans-unit but can vary as a child of alt-trans.
So I think it's probably the mismatch between de and de-de that is causing the complaint. You could align these values, or just remove xml:space from the <source> element entirely, as it is optional in this context.

Struts Tiles ActionError

Good Afternoon in my timezone.
I am using Struts tiles framework to build a Web app, and i am facing a very strange problem.
I am running out of time to finish the work and if i am not able to fix this problem i will give up of using Tiles in this project.
My Tiles configuration is very simple.
In my struts-config.xml i insert the following code:
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" />
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" value="/WEB-INF/tilesdefs.xml" />
<set-property property="moduleAware" value="true" />
</plug-in>
In the tilesdefs.xml i have this simple code :
<component-definitions>
<definition name="programarRutasTile" path="/programarRutas.jsp">
<put name="menu" value="menu.jsp"/>
<put name="tab" type="String" value="2"/>
</definition>
</component-definitions>
And in the jsp "programarRutas.jsp" i have those three Tiles code lines:
<tiles:insert name="menu">
<tiles:put name="tabSelected"><tiles:getAsString name="tab"/></tiles:put>
</tiles:insert>
The menu.jsp is simple html code that make use of the tabSelected attribute passed in the programarRutas.jsp (code above).
I already try to run with all the menu.jsp page commented and the error persist.
So now will explain the error:
When i run the application and the ActionForm validate method do not find any error, the application runs normally, if the ActionForm validate method finds errors and fullfill the ActionErrors array , then the application throws the following exception :
java.lang.NullPointerException at org.apache.struts.tiles.taglib.InsertTag.processName...
The only way i can run when the application finds errors is commenting the Tiles lines code in the programarRutas.jsp
//<tiles:insert name="menu">
// <tiles:put name="tabSelected"><tiles:getAsString name="tab"/></tiles:put>
//</tiles:insert>
That way there is no throw exception. By those symptoms that i describe it looks like that there could be a problem in some configuration file, but i do not no for sure.
Is there anybody that could help me ???
Best regards.
Thanks in advance
The input should be the tile def, not a direct link to the JSP.